maven使用指定的pom文件构建子模块

有条件的同学建议直接浏览原文:

https://stackoverflow.com/questions/33396390/custom-pom-xml-filename-in-maven-multimodule-for-tycho

 

maven工程包含多个子模块的结构如下:

 

现在需要在module-1模块下添加pom-standlone.xml文件,用于构建module-1的standlone版本。

工程结构如下:

 

 这里需要注意:

1、只在module-1模块下添加pom-standlone.xml无法实现指定pom文件构建子模块;

2、在module-1模块下添加pom-standlone.xml文件,对依赖进行定义;

3、在项目工程下复制一份pom.xml命名为pom-standlone.xml,并在modules中指定pom文件,内容参考如下:

<modules>
    <module>module-1/pom-standlone.xml</module>
    <module>module-2</module>
    <module>module-3</module>
</modules>

在项目根路径maven构建命令:

mvn clean package -pl moude-1 -am -f pom-standlone.xml

 

posted @ 2023-02-14 18:13  codest  阅读(819)  评论(0编辑  收藏  举报