感谢刘老师
image.png
GitLab项目地址:
https://rdc.hand-china.com/gitlab/wh-training-2018/wht-parent
环境准备:
软件 | 本版 | 下载地址 |
---|---|---|
JDK | 8u81 | Java SE Development Kit 8 Downloads |
Maven | 3.5.4 | http://maven.apache.org/download.cgi |
Redis for Windows | 3.2.100 | https://github.com/MicrosoftArchive/redis/reledownloadases/tag/win-3.2.100 |
Mysql | 5.7.22 | https://dev.mysql.com/downloads/windows/installer/5.7.html |
IDEA | 2017.3 | https://download.jetbrains.com/idea/ideaIU-2017.3.5.exe |
Git for Windows | 2.18.0 | https://github.com/git-for-windows/git/releases/latest |
1、初始化项目:
mvn install clean
2、新建数据库:
CREATE SCHEMA wht_dev DEFAULT CHARACTER SET utf8;
CREATE USER wht_dev@'%' IDENTIFIED BY 'wht_dev';
CREATE USER wht_dev@'localhost' IDENTIFIED BY 'wht_dev';
GRANT ALL PRIVILEGES ON wht_dev.* TO wht_dev@'%';
GRANT ALL PRIVILEGES ON wht_dev.* TO wht_dev@'localhost';
FLUSH PRIVILEGES;
3、执行数据库初始化:
mvn process-resources -D skipLiquibaseRun=false -D db.driver=com.mysql.jdbc.Driver -D db.url=jdbc:mysql://localhost:3306/wht_dev -D db.user=wht_dev -D db.password=wht_dev
当我们执行mvn install clean 后,会向私服拉取依赖jar包,这些Java包中包含了.groovy脚本(下图:如2017-03-16-core-init-table-migration.groovy、2016-06-09-core-init-data-migration.groovy、core-init-data.xlsx 可以把jar包复制出来,然后解压就可以看到那些数据了)
image.png4、配置redis:
- 编辑配置文件redis.conf 被修改daemonize属性为yes
# By default Redis does not run as a daemon. Use 'yes' if you need it.
# Note that Redis will write a pid file in /var/run/redis.pid when daemonized.
daemonize yes
- 启动redis(一般你安装后,会自动启动,服务中可见)
cd /path/to/redis src/redis-server
./redis.conf
5、配置tomcat
- 配置数据源 conf/context.xml:
<Resource auth="Container" driverClassName="com.mysql.jdbc.Driver"
type="javax.sql.DataSource"
url="jdbc:mysql://localhost:3306/wht_dev"
name="jdbc/wht_dev"
username="wht_dev"
password="wht_dev"/>
更改项目数据源配置 config.properties
:
#崔世宙_本地数据源
db.jndiName=java:comp/env/jdbc/wht_dev
mvn install clean
网友评论