maven jar 在一个 war 模块中部署了两次,attachClasses 设置为 true [英] maven jar deployed twice in a war module with attachClasses set to true

查看:90
本文介绍了maven jar 在一个 war 模块中部署了两次,attachClasses 设置为 true的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图通过将模块部署到我们的 nexus 存储库来将其用作另一个项目的依赖项.问题是 maven 尝试部署 jar 两次,而我们的策略禁止覆盖发布版本.该模块被打包为war.这是我的配置.

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>

当我将 attachClasses 设置为 false 时,一切正常并且战争被部署,但 jar 没有.当我将它设置为 true 时,jar 被部署,但 maven 尝试第二次部署,然后构建失败.知道为什么 maven 尝试部署它两次.(该模块有一个父模块,但它不依赖于项目中的任何其他模块).

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).

推荐答案

问题可能是你定义了自己的执行.

The problem is probably that you defined your own execution.

尝试删除块

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

这篇关于maven jar 在一个 war 模块中部署了两次,attachClasses 设置为 true的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆