美文网首页
maven聚合和自动部署-06

maven聚合和自动部署-06

作者: 誓俭草 | 来源:发表于2019-08-28 22:31 被阅读0次

maven相关知识点-05

maven的聚合

  • 为什么要使用聚合?
    将多个工程拆分为模块后,需要手动逐个安装到仓库后依赖才能够生效。修改源码后也需要逐个手动进
    行 clean 操作。而使用了聚合之后就可以批量进行 Maven 工程的安装、清理工作。

  • 如何配置聚合?
    在总的聚合工程中使用 modules/module 标签组合,指定模块工程的相对路径即可

    <modules>
        <module>../Hello</module>
        <module>../HelloFriend</module>
        <module>../MakeFriends</module>
    </modules>
    
  • 打包在总工程的pom文件右键run as ——> maven install。

maven的自动部署

Web工程自动部署

<build>
        <finalName>AtguiguWeb</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>


相关文章

网友评论

      本文标题:maven聚合和自动部署-06

      本文链接:https://www.haomeiwen.com/subject/xrpvectx.html