Warm tip: This article is reproduced from serverfault.com, please click

其他-如何控制maven内置的jar中的pom.xml?

(其他 - how to control the pom.xml inside jar built by maven?)

发布于 2010-12-14 09:40:25

当maven生成一个jar时,它将pom.xml放在META-INF //// pom.xml中。这是工件的原始pom。没有扩展或继承变量,也没有列出任何继承的依赖项。这使得生产jar的信息取决于构建环境。

罐子里的pom如何配置?最好是对maven-jar-plugin进行一些配置。

Questioner
openCage
Viewed
0
2017-05-23 18:29:40

我有一个类似的要求,因为我想获取属于父级的所有信息pom.xml在别人的话,我想有,除了“原始” pom.xml,则有效的POM产生的JAR内。

这个想法是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>

来源