【问题标题】:maven jar deployed twice in a war module with attachClasses set to truemaven jar 在一个 war 模块中部署了两次,attachClasses 设置为 true
【发布时间】:2020-04-10 02:10:24
【问题描述】:

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

            <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 尝试部署它两次。 (该模块有一个父模块,但它不依赖于项目中的任何其他模块)。

【问题讨论】:

    标签: maven maven-3 war nexus


    【解决方案1】:

    问题可能是您定义了自己的执行。

    尝试删除块

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

    【讨论】:

      猜你喜欢
      • 2021-03-31
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-10-10
      • 1970-01-01
      相关资源
      最近更新 更多