当 maven 构建一个 jar 时,它会在 META-INF///pom.xml 中放置一个 pom.xml。这是神器的原始pom。没有变量被扩展或继承,也没有列出继承的依赖项。这使得生产 jar 的信息依赖于构建环境。
jar里面的pom怎么配置?最好是 maven-jar-plugin 的一些配置。
我有类似的要求,因为我想获取属于 parent 的所有信息pom.xml
。换句话说,除了 "raw" 之外,我还想在生成的 JARpom.xml
中拥有有效的 pom 。
这个想法是help:effective-pom
在生成 JAR 期间使用插件和目标,并将其与pom.xml
. 这是通过以下配置完成的:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-help-plugin</artifactId>
<version>2.1.1</version>
<executions>
<execution>
<phase>generate-resources</phase>
<goals>
<goal>effective-pom</goal>
</goals>
<configuration>
<output>${project.build.outputDirectory}/META-INF/maven/${project.groupId}/${project.artifactId}/effective-pom.xml</output>
</configuration>
</execution>
</executions>
</plugin>
(来源)