* 配置好jdk
* 下载安装maven
http://maven.apache.org/download.cgi
* 解压到G:/apache-maven-3.5.3-bin
* 添加环境变量
** 添加 M2_HOME 和 MAVEN_HOME 环境变量到 Windows 环境变量,并将其指向你的 Maven 文件夹
** Path环境变量添加 %M2_HOME%/bin
* 查看mvn版本
1
|
mvn -version
|
Apache Maven 3.5.3 (3383c37e1f9e9b3bc3df5050c29c8aff9f295297; 2018-02-25T03:49:05+08:00)
Maven home: G:/apache-maven-3.5.3-bin/bin/..
Java version: 1.8.0_131, vendor: Oracle Corporation
Java home: C:/Program Files/Java/jdk1.8.0_131/jre
Default locale: zh_CN, platform encoding: GBK
OS name: “windows 10”, version: “10.0”, arch: “amd64”, family: “windows”
* mvn编译打包
** 先把命令行切换到Maven项目的根目录
1
|
cd G:/eclipse-workspace/platform/enso-admin
|
** 编译
1
|
mvn clean compile
|
output:
mvn clean compile
** 打包
1
|
mvn clean package
|
output:
mvn clean package
output…
** 部署
# 根据上一步的输出 把 复制出来
1
2
3
|
copy G:/eclipse-workspace/platform/enso-admin/target/enso-admin-1.0.war G:/apache-tomcat-7.0.88-windows-x64/webapps/enso-admin.war
G:/apache-tomcat-7.0.88-windows-x64/bin/startup.bat
|
需要先设置环境变量 CATALINA_HOME
The CATALINA_HOME environment variable is not defined correctly
This environment variable is needed to run this program
1
|
set CATALINA_HOME=G:/apache-tomcat-7.0.88-windows-x64
|
再试启动tomcat
1
|
%CATALINA_HOME%/bin/startup.bat
|
Using CATALINA_BASE: “G:/apache-tomcat-7.0.88-windows-x64”
Using CATALINA_HOME: “G:/apache-tomcat-7.0.88-windows-x64”
Using CATALINA_TMPDIR: “G:/apache-tomcat-7.0.88-windows-x64/temp”
Using JRE_HOME: “C:/Program Files/Java/jdk1.8.0_131”
Using CLASSPATH: “G:/apache-tomcat-7.0.88-windows-x64/bin/bootstrap.jar;G:/apache-tomcat-7.0.88-windows-x64/bin/tomcat-juli.jar”
** 配置不对 先停掉tomcat服务
1
2
|
%CATALINA_HOME%/bin/ shutdown .bat
del %CATALINA_HOME%/webapps/enso-admin-1.0.war
|
** 修改配置
1
2
|
@doskey n2= "C:/Program Files (x86)/Notepad++/notepad++.exe" $*
n2 %CATALINA_HOME%/conf/server.xml
|
在server.xml文件的 </Host> 闭合标签前面添加一行
1
|
< Context docBase="enso-admin" path="/" reloadable="true" source="org.eclipse.jst.jee.server:enso-admin"/>
|
** 再启动
1
|
%CATALINA_HOME%/bin/startup.bat
|
** 数据库连接失败
1
2
|
set PROJECT=enso-admin
n2 %CATALINA_HOME%/webapps/%PROJECT%/WEB-INF/classes/jdbc.properties
|
** 浏览器访问
先试试 http://localhost:8080/enso-admin
然后重启tomcat
1
2
|
%CATALINA_HOME%/bin/ shutdown .bat
%CATALINA_HOME%/bin/startup.bat
|
再访问 http://localhost:8080/
原创文章,作者:Maggie-Hunter,如若转载,请注明出处:https://blog.ytso.com/1462.html