我有一个多模块的maven项目。我希望组装每个子程序,以便当它们被解压缩并使用maven执行时,不依赖于父pom。
是否有一种使用组装插件来“合并”父pom和子pom的方法?
原始项目:
├── pom.xml
├── README.md
├── module1
│ ├── assembly.xml
│ ├── pom.xml
│ ├── README.md
│ └── src
└── module2
├── assembly.xml
├── pom.xml
├── README.md
└── src组装包(zip):
moduleX
├── pom.xml <-- merged pom
├── README.md
└── src打包的程序集将由组织外部的外部客户端使用,因此他无法访问我们的存储库。
更新: JF建议的,使用flatten-maven-plugin解决了我的问题。
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>flatten-maven-plugin</artifactId>
<version>1.2.1</version>
<executions>
<execution>
<id>flatten</id>
<phase>prepare-package</phase>
<goals>
<goal>flatten</goal>
</goals>
<configuration>
<flattenMode>bom</flattenMode>
<pomElements>
<build>keep</build>
</pomElements>
</configuration>
</execution>
</executions>
</plugin>然后在我的assembly.xml上添加生成的.flattened-pom.xml并将其重命名为pom.xml:
<files>
<file>
<source>.flattened-pom.xml</source>
<destName>pom.xml</destName>
</file>
</files> 发布于 2020-03-04 19:18:56
https://stackoverflow.com/questions/60532302
复制相似问题