maven 简单实用教程
</tomcat-users>
?
在pom文件的tomcat插件中添加:
?
??????????????????????? <plugin>
??????????????????????????????? <groupId>org.codehaus.mojo</groupId>
??????????????????????????????? <artifactId>tomcat-maven-plugin</artifactId>
??????????????????????????????? <configuration>
??????????????????????????????????????? <url>http://localhost:8080/manager</url>
??????????????????????????????????????? <server>myserver</server>
??????????????????????????????????????? <path>/mycontext</path>
??????????????????????????????? </configuration>
??????????????????????? </plugin>
?
在.m2/settings.xml文件中增加:
?
<settings xmlns="http://maven.apache.org/POM/4.0.0"
??????? xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
??????? xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/settings-1.0.0.xsd">
??????? <servers>
??????????????? <server>
??????????????????????? <id>myserver</id>
??????????????????????? <username>marshal</username>
??????????????????????? <password>password</password>
??????????????? </server>
??????? </servers>
</settings>
?
运行打包部署,在maven项目目录下:
?
mvn tomcat:deploy
?
然后访问:http://localhost:8080/mycontext/ 即可。
撤销部署:
?
mvn tomcat:undeploy
?
启动web应用:
?
mvn tomcat:start
?
停止web应用:
?
mvn tomcat:stop
?
重新部署:
?
mvn tomcat:redeploy
?
部署展开的war文件:
?
mvn war:exploded tomcat:exploded
?
?
3.3.4. 未讲到的内容
?
settings.xml的配置
pom.xml的详细配置
自定义插件的方法:http://maven.apache.org/plugins/maven-archetype-plugin/examples/archetype.html
自定义goal的执行:<preGoal><postGoal>
插件的查询和使用
搭建镜像repository
在maven中调用ant