maven 构建 web 工程

 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 


                                                                       

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值