WEB
1 mvn archetype:generate -DgroupId=com.mycompany.app -DartifactId=my-webapp -DarchetypeArtifactId=maven-archetype-webapp
<project> <modelVersion>4.0.0</modelVersion> <groupId>com.mycompany.app</groupId> <artifactId>my-webapp</artifactId> <packaging>war</packaging> <version>1.0-SNAPSHOT</version> <dependencies> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>3.8.1</version> <scope>test</scope> </dependency> </dependencies> <build> <finalName>my-webapp</finalName> </build> </project>
2 mvn -Dwtpversion=1.0 eclipse:eclipse <参与:http://maven.apache.org/plugins/maven-eclipse-plugin/wtp.html>
3 <plugin> 参考http://mojo.codehaus.org/jetty-maven-plugin/usage.html
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>7.1.6.v20100715</version>
<configuration>
<scanIntervalSeconds>10</scanIntervalSeconds>
<webAppConfig>
<contextPath>/account</contextPath>
</webAppConfig>
</configuration>
</plugin>
4 mvn jetty:run
5 查看 http://localhost:8080/account/ 《account 与上面配置相同》
6 如果要改变jetty 的端口:mvn jetty:run -Djetty.port=9999 这样就可以用localhost:9999/ 访问的了:
7要停止jetty : ctrl + C
8 用cargo: 部署到本地 容器中去: 加上下面插件:
<plugin>
<groupId>org.codehaus.cargo</groupId>
<artifactId>cargo-maven2-plugin</artifactId>
<version>1.0</version>
<configuration>
<container>
<containerId>tomcat6x</containerId>
<home>C:\Program Files\apache-tomcat-6.0.33</home>
</container>
<configuration>
<type>standalone</type>
<home>${project.build.directory}/tomcat6x</home>
</configuration>
</configuration>
</plugin>
9 : mvn cargo:start
》