开发者

war manifest gets created in multiple locations

开发者 https://www.devze.com 2023-03-28 01:21 出处:网络
http://maven.apache.org/pl开发者_StackOverflow中文版ugins/maven-war-plugin/manifest-mojo.html When I run the above goal via maven, it creates the manifest under /src/main/webapp/META-INF/MANIFEST.MF

http://maven.apache.org/pl开发者_StackOverflow中文版ugins/maven-war-plugin/manifest-mojo.html

When I run the above goal via maven, it creates the manifest under /src/main/webapp/META-INF/MANIFEST.MF as well as correctly under the target folder during war creation.

I would expect the plug-in to not generate additional artifacts under the source directory, how should I prevent this and it happens with the 2.2.1 version of the maven-war-plugin


It says right on that page you linked: "The manifest file is created in the warSourceDirectory." It's a configurable property. You can change it if you like. The one in target is probably just a maven-resources-plugin copy of the one in the src dir.


Rather than using the war:manifest goal, just add the following configuration to your maven-war-plugin, as described here:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-war-plugin</artifactId>
    <version>2.1.1</version>
    <configuration>
        <archive>
            <manifest>
                <addClasspath>true</addClasspath>
            </manifest>
        </archive>
    </configuration>
</plugin>

This will automatically generate the MANIFEST.MF during the execution of the war:war goal only in the build output, and not in the source directory.

0

精彩评论

暂无评论...
验证码 换一张
取 消