美文网首页
使用 maven-antrun-plugin 聚合应用

使用 maven-antrun-plugin 聚合应用

作者: 山间草夫 | 来源:发表于2021-02-20 11:23 被阅读0次

maven聚合多模块项目的包到统一的目录下面,
需求: 将项目子模块中所有的jar,或者war包聚合到项目根目录的target目录, 方便脚本上传, 不用自己每个文件夹去找然后上传。

 <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-antrun-plugin</artifactId>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>run</goal>
                        </goals>
                        <configuration>
                            <tasks>
<!-- 创建目录, 在clean 的时候会清除target, 如果没有目录会报错 -->
                                <mkdir dir="${session.executionRootDirectory}/target" />
<!-- todir 文件的目的地文件夹  -->
                                <copy todir="${session.executionRootDirectory}/target">
<!-- dir 表示项目(子模块)编译的目录, 一般是target文件夹  -->
                                    <fileset dir="${project.build.directory}/">
                                        <include name="*.jar"/>
                                         <include name="*.war"/>
                                    </fileset>
                                </copy>
                            </tasks>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

相关文章

网友评论

      本文标题:使用 maven-antrun-plugin 聚合应用

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