maven jar deployed twice in a war module with attachClasses set to true

萝らか妹 提交于 2021-02-11 12:15:15

问题


I am trying to use module as a dependency in another project by deploying it to our nexus repository. The problem is that maven tries to deploy the jar twice and our policy forbids to overwrite a release version. The module is packaged as a war. Here is my configuration.

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-war-plugin</artifactId>
                <version>2.3</version>
                <executions>
                    <execution>
                        <id>build-war</id>
                        <phase>package</phase>
                        <goals>
                            <goal>war</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <attachClasses>true</attachClasses>
                    <failOnMissingWebXml>true</failOnMissingWebXml>
                </configuration>
            </plugin>

When I set attachClasses to false, everything goes fine and the war gets deployed, but the jar doesn't. When I set it to true, the jar gets deployed but maven tries to deploy a second time and then the build fails. Any idea why maven tries to deploy it twice. (The module has a parent module, but it does not depend on any other module from the project).


回答1:


The problem is probably that you defined your own execution.

Try to remove the block

           <executions>
                <execution>
                    <id>build-war</id>
                    <phase>package</phase>
                    <goals>
                        <goal>war</goal>
                    </goals>
                </execution>
            </executions>


来源:https://stackoverflow.com/questions/59376513/maven-jar-deployed-twice-in-a-war-module-with-attachclasses-set-to-true

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!