开发者

Maven deploy to folder

After I do "mvn clean install". I get the compiled jar in my target fo开发者_StackOverflowlder. Now I want to configure Maven to automatically copy this jar and overwrite the old jar in a specific directory? (ie: %tomcat_dir%/WEB-INF/lib) when I enter a goal such as "mvn deploy"?


This is citation from Maven Quick Reference:

Add Maven-Plugin to pom.xml:

<plugins>
...
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>tomcat-maven-plugin</artifactId>
<configuration>
<url>http://192.168.129.36:8080/manager/html</url>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.cargo</groupId>
<artifactId>cargo-maven2-plugin</artifactId>
</plugin>
...
</plugins>
...
<repositories>
<repository>
<id>codehaus</id>
<name>Codehaus maven repository</name>
<url>http://dist.codehaus.org/</url>
<layout>legacy</layout>
</repository>
...
</repositories>

Then run Tomcat with

mvn tomcat:run

Deploy the war automatically with

mvn tomcat:deploy

If already deployed, the webapp needs to be undeployed first:

mvn tomcat:undeploy

Note that automatic deployment/undeployment only works without further configuration in $MAVEN2_HOME/conf/settings.xml if the managers username is admin with empty password

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜