Java培训Maven工程 Web工程自动部署

除了在Eclipse中使用Run as→run on server的方式运行Web工程,还可以配置Web工程的自动部署。

①配置自动部署

<build>

    <finalName>web</finalName>

    <plugins>

          <plugin>

              <groupId>org.codehaus.cargo</groupId>

              <artifactId>cargo-maven2-plugin</artifactId>

                     <version>1.2.3</version>

                     <configuration>

                         <container>

                             <containerId>tomcat6x</containerId>

                             <home>D:\DevInstall\apache-tomcat-6.0.39</home>

                         </container>

                         <configuration>

                             <type>existing</type>

                             <home>D:\DevInstall\apache-tomcat-6.0.39</home>

                             <!– 如果Tomcat端口为默认值8080则不必设置该属性 –>

                             <properties>

                                   <cargo.servlet.port>8989</cargo.servlet.port>

                             </properties>

                         </configuration>

                     </configuration>

                     <executions> 

                  <execution> 

                      <id>cargo-run</id> 

                      <phase>install</phase> 

                      <goals> 

                          <goal>run</goal> 

                      </goals> 

                  </execution> 

              </executions>

          </plugin>

      </plugins>

  </build>

②部署Web项目的命令:mvn deploy

想要了解跟多关于Java培训课程内容欢迎关注尚硅谷Java培训,尚硅谷除了这些技术文章外还有免费的高质量Java培训课程视频供广大学员下载学习


上一篇:
下一篇: