怎么将maven工程部署到服务器上
1个回答
展开全部
pom配置
Java代码
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.1</version>
<configuration>
<url>http://192.0.0.203:8080/manager/text</url>
<server>server203</server>
<path>/energy</path>
</configuration>
</plugin>
setting.xml
Java代码
<server>
<id>unknown</id>
<username>tomcat</username>
<password>tomcat</password>
</server>
tomcat配置有管理权限的用户:conf\tomcat-users.xml
Java代码
<?xml version='1.0' encoding='utf-8'?>
<tomcat-users>
<role rolename="manager"/>
<user username="marshal" password="password" roles="manager"/>
</tomcat-users>
相关命令
运行打包部署:
Java代码
mvn tomcat:deploy
撤销部署:
Java代码
mvn tomcat:undeploy
启动web应用:
Java代码
mvn tomcat:start
停止web应用:
Java代码
mvn tomcat:stop
重新部署:
Java代码
mvn tomcat:redeploy
部署展开的文件:
Java代码
mvn war:exploded tomcat:exploded
自动部署脚本
Java代码
echo [Step 1] tomcat7:undeploy
call mvn tomcat7:undeploy
if errorlevel 1 goto error
echo [Step 1] tomcat7:undeploy
call mvn tomcat7:deploy -Dmaven.test.skip=true
if errorlevel 1 goto error
goto end
:error
echo Error Happen!!
:end
本配置仅适用tomcat7的maven插件,tomcat6请修改配置
Java代码
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.1</version>
<configuration>
<url>http://192.0.0.203:8080/manager/text</url>
<server>server203</server>
<path>/energy</path>
</configuration>
</plugin>
setting.xml
Java代码
<server>
<id>unknown</id>
<username>tomcat</username>
<password>tomcat</password>
</server>
tomcat配置有管理权限的用户:conf\tomcat-users.xml
Java代码
<?xml version='1.0' encoding='utf-8'?>
<tomcat-users>
<role rolename="manager"/>
<user username="marshal" password="password" roles="manager"/>
</tomcat-users>
相关命令
运行打包部署:
Java代码
mvn tomcat:deploy
撤销部署:
Java代码
mvn tomcat:undeploy
启动web应用:
Java代码
mvn tomcat:start
停止web应用:
Java代码
mvn tomcat:stop
重新部署:
Java代码
mvn tomcat:redeploy
部署展开的文件:
Java代码
mvn war:exploded tomcat:exploded
自动部署脚本
Java代码
echo [Step 1] tomcat7:undeploy
call mvn tomcat7:undeploy
if errorlevel 1 goto error
echo [Step 1] tomcat7:undeploy
call mvn tomcat7:deploy -Dmaven.test.skip=true
if errorlevel 1 goto error
goto end
:error
echo Error Happen!!
:end
本配置仅适用tomcat7的maven插件,tomcat6请修改配置
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询