maven artifacts*-classes.jar部署两次到repository-attachclasses

kmbjn2e3  于 2021-07-06  发布在  Java
关注(0)|答案(0)|浏览(166)

我注意到,*-classes.jars是由于在多模块maven项目中的某个模块中设置了attachclasses而产生的,它部署了两次,而且由于我们想将策略更改为不部署版本等两次,所以需要修复。问题只发生在模块中,该模块使用maven war plugin构建为war,attachclasses=true且仅影响-classes.jar,其他工件(如源、poms等)只部署一次,这是可以的。双重上传发生在maven部署插件部署阶段。我已经研究了有效的pom,但是没有明显的发现,没有重复的定义,目标等。项目是相当复杂和相互交织的,所以我只列出pom定义中有趣的部分,如果有人知道什么可能是错误的,我会很高兴的。
以下命令用于生成:

mvn -P jboss --batch-mode -U -Dmaven.javadoc.skip=true -Dorg.xml.sax.driver=com.sun.org.apache.xerces.internal.parsers.SAXParser -pl '!dist' clean package

快照或发布上载到存储库时出现问题。
在家长聚会上,我有其他的东西:

<plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <configuration>
                    <archive>
                        <addMavenDescriptor>false</addMavenDescriptor>
                        <manifest>
                            <mainClass>${start-class}</mainClass> <!-- from Spring Boot -->
                            <addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
                            <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
                        </manifest>
                        <manifestEntries>
                            <Implementation-Build>${buildNumber}</Implementation-Build>
                            <Implementation-Build-Time>${maven.build.timestamp}</Implementation-Build-Time>
                            <Jenkins-Build-Number>${build.number}</Jenkins-Build-Number>
                            <Jenkins-Build-Id>${build.id}</Jenkins-Build-Id>
                            <Jenkins-Build-Tag>${build.tag}</Jenkins-Build-Tag>
                            <Jenkins-Git-Commit>${build.git.commit}</Jenkins-Git-Commit>
                            <Jenkins-Git-Branch>${build.git.branch}</Jenkins-Git-Branch>
                        </manifestEntries>
                    </archive>
                    <excludes>
                        <!-- This is where the exclusion occurs -->
                        <exclude>**/aaa.ear</exclude>
                    </excludes>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-release-plugin</artifactId>
                <version>2.5.1</version>
                <configuration>
                    <autoVersionSubmodules>true</autoVersionSubmodules>
                    <useReleaseProfile>false</useReleaseProfile>
                    <releaseProfiles>release</releaseProfiles>
                    <goals>deploy</goals>
                </configuration>
            </plugin>

            <!-- build source artifacts by default -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-source-plugin</artifactId>
                <version>2.4</version>
                <executions>
                    <execution>
                        <id>attach-sources</id>
                        <goals>
                            <goal>jar-no-fork</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

<plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-assembly-plugin</artifactId>
                <configuration>
                    <descriptorRefs>
                        <descriptorRef>jar-with-dependencies</descriptorRef>
                    </descriptorRefs>
                    <archive>
                        <manifest>
                            <mainClass>cz.bsc.g8.rbcz.onb.web.OnbApplication</mainClass>
                        </manifest>
                    </archive>
                    <attach>false</attach>
                </configuration>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>single</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

在受影响的模块中,我有:

<profiles>
    <profile>
        <id>for-ear</id>
        <activation>
            <file>
                <exists>pom.xml</exists>
            </file>
        </activation>
        <build>
            <plugins>
                <plugin>
                    <artifactId>maven-war-plugin</artifactId>
                    <executions>
                        <execution>
                            <id>for-ear</id>
                            <goals>
                                <goal>war</goal>
                            </goals>
                            <phase>package</phase>
                            <configuration>
                                <classifier>ear</classifier>
                                <webappDirectory>${project.build.directory}/for-ear</webappDirectory>
                                <!-- in ear log4j2 will be places -->
                                <packagingExcludes>WEB-INF/classes/log4j2.xml</packagingExcludes>
                            </configuration>
                        </execution>
                    </executions>
                    <configuration>
                        <archive>
                            <manifest>
                                <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
                                <addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
                            </manifest>
                        </archive>
                        <archiveClasses>true</archiveClasses>
                        <attachClasses>true</attachClasses>
                    </configuration>
                </plugin>
            </plugins>
        </build>
    </profile>
</profiles>

更新:添加了build的输出,只是一部分,您可以看到无效的输出(第15行和第27行),artifact dsa-web-1.3-20201121.012503-66-classes.jar上载了两次:

02:25:03  [INFO] --- maven-deploy-plugin:2.8.2:deploy (default-deploy) @ dsa-web ---
02:25:03  [INFO] Using alternate deployment repository ACD Snapshot Repository::default::http://triton.acdlon.com:8081/nexus/content/repositories/snapshots
02:25:03  [INFO] Downloading from ACD Snapshot Repository: http://triton.acdlon.com:8081/nexus/content/repositories/snapshots/cz/acdlon/b5/lgdn/dsa-web/1.3-SNAPSHOT/maven-metadata.xml
02:25:03  [INFO] Downloaded from ACD Snapshot Repository: http://triton.acdlon.com:8081/nexus/content/repositories/snapshots/cz/acdlon/b5/lgdn/dsa-web/1.3-SNAPSHOT/maven-metadata.xml (1.6 kB at 56 kB/s)
02:25:03  [INFO] Uploading to ACD Snapshot Repository: http://triton.acdlon.com:8081/nexus/content/repositories/snapshots/cz/acdlon/b5/lgdn/dsa-web/1.3-SNAPSHOT/dsa-web-1.3-20201121.012503-66.war
02:25:07  [INFO] Uploaded to ACD Snapshot Repository: http://triton.acdlon.com:8081/nexus/content/repositories/snapshots/cz/acdlon/b5/lgdn/dsa-web/1.3-SNAPSHOT/dsa-web-1.3-20201121.012503-66.war (88 MB at 20 MB/s)
02:25:07  [INFO] Uploading to ACD Snapshot Repository: http://triton.acdlon.com:8081/nexus/content/repositories/snapshots/cz/acdlon/b5/lgdn/dsa-web/1.3-SNAPSHOT/dsa-web-1.3-20201121.012503-66.pom
02:25:07  [INFO] Uploaded to ACD Snapshot Repository: http://triton.acdlon.com:8081/nexus/content/repositories/snapshots/cz/acdlon/b5/lgdn/dsa-web/1.3-SNAPSHOT/dsa-web-1.3-20201121.012503-66.pom (15 kB at 672 kB/s)
02:25:07  [INFO] Downloading from ACD Snapshot Repository: http://triton.acdlon.com:8081/nexus/content/repositories/snapshots/cz/acdlon/b5/lgdn/dsa-web/maven-metadata.xml
02:25:07  [INFO] Downloaded from ACD Snapshot Repository: http://triton.acdlon.com:8081/nexus/content/repositories/snapshots/cz/acdlon/b5/lgdn/dsa-web/maven-metadata.xml (451 B at 5.8 kB/s)
02:25:07  [INFO] Uploading to ACD Snapshot Repository: http://triton.acdlon.com:8081/nexus/content/repositories/snapshots/cz/acdlon/b5/lgdn/dsa-web/1.3-SNAPSHOT/maven-metadata.xml
02:25:07  [INFO] Uploaded to ACD Snapshot Repository: http://triton.acdlon.com:8081/nexus/content/repositories/snapshots/cz/acdlon/b5/lgdn/dsa-web/1.3-SNAPSHOT/maven-metadata.xml (1.6 kB at 67 kB/s)
02:25:07  [INFO] Uploading to ACD Snapshot Repository: http://triton.acdlon.com:8081/nexus/content/repositories/snapshots/cz/acdlon/b5/lgdn/dsa-web/maven-metadata.xml
02:25:07  [INFO] Uploaded to ACD Snapshot Repository: http://triton.acdlon.com:8081/nexus/content/repositories/snapshots/cz/acdlon/b5/lgdn/dsa-web/maven-metadata.xml (451 B at 17 kB/s)
02:25:07  [INFO] Uploading to ACD Snapshot Repository: http://triton.acdlon.com:8081/nexus/content/repositories/snapshots/cz/acdlon/b5/lgdn/dsa-web/1.3-SNAPSHOT/dsa-web-1.3-20201121.012503-66-classes.jar
02:25:07  [INFO] Uploaded to ACD Snapshot Repository: http://triton.acdlon.com:8081/nexus/content/repositories/snapshots/cz/acdlon/b5/lgdn/dsa-web/1.3-SNAPSHOT/dsa-web-1.3-20201121.012503-66-classes.jar (509 kB at 10 MB/s)
02:25:07  [INFO] Uploading to ACD Snapshot Repository: http://triton.acdlon.com:8081/nexus/content/repositories/snapshots/cz/acdlon/b5/lgdn/dsa-web/1.3-SNAPSHOT/maven-metadata.xml
02:25:07  [INFO] Uploaded to ACD Snapshot Repository: http://triton.acdlon.com:8081/nexus/content/repositories/snapshots/cz/acdlon/b5/lgdn/dsa-web/1.3-SNAPSHOT/maven-metadata.xml (1.6 kB at 85 kB/s)
02:25:07  [INFO] Uploading to ACD Snapshot Repository: http://triton.acdlon.com:8081/nexus/content/repositories/snapshots/cz/acdlon/b5/lgdn/dsa-web/1.3-SNAPSHOT/dsa-web-1.3-20201121.012503-66-exec.war
02:25:13  [INFO] Uploaded to ACD Snapshot Repository: http://triton.acdlon.com:8081/nexus/content/repositories/snapshots/cz/acdlon/b5/lgdn/dsa-web/1.3-SNAPSHOT/dsa-web-1.3-20201121.012503-66-exec.war (94 MB at 21 MB/s)
02:25:13  [INFO] Uploading to ACD Snapshot Repository: http://triton.acdlon.com:8081/nexus/content/repositories/snapshots/cz/acdlon/b5/lgdn/dsa-web/1.3-SNAPSHOT/maven-metadata.xml
02:25:13  [INFO] Uploaded to ACD Snapshot Repository: http://triton.acdlon.com:8081/nexus/content/repositories/snapshots/cz/acdlon/b5/lgdn/dsa-web/1.3-SNAPSHOT/maven-metadata.xml (1.6 kB at 90 kB/s)
02:25:13  [INFO] Uploading to ACD Snapshot Repository: http://triton.acdlon.com:8081/nexus/content/repositories/snapshots/cz/acdlon/b5/lgdn/dsa-web/1.3-SNAPSHOT/dsa-web-1.3-20201121.012503-66-sources.jar
02:25:13  [INFO] Uploaded to ACD Snapshot Repository: http://triton.acdlon.com:8081/nexus/content/repositories/snapshots/cz/acdlon/b5/lgdn/dsa-web/1.3-SNAPSHOT/dsa-web-1.3-20201121.012503-66-sources.jar (156 kB at 5.2 MB/s)
02:25:13  [INFO] Uploading to ACD Snapshot Repository: http://triton.acdlon.com:8081/nexus/content/repositories/snapshots/cz/acdlon/b5/lgdn/dsa-web/1.3-SNAPSHOT/maven-metadata.xml
02:25:13  [INFO] Uploaded to ACD Snapshot Repository: http://triton.acdlon.com:8081/nexus/content/repositories/snapshots/cz/acdlon/b5/lgdn/dsa-web/1.3-SNAPSHOT/maven-metadata.xml (1.6 kB at 81 kB/s)
02:25:13  [INFO] Uploading to ACD Snapshot Repository: http://triton.acdlon.com:8081/nexus/content/repositories/snapshots/cz/acdlon/b5/lgdn/dsa-web/1.3-SNAPSHOT/dsa-web-1.3-20201121.012503-66-classes.jar
02:25:13  [INFO] Uploaded to ACD Snapshot Repository: http://triton.acdlon.com:8081/nexus/content/repositories/snapshots/cz/acdlon/b5/lgdn/dsa-web/1.3-SNAPSHOT/dsa-web-1.3-20201121.012503-66-classes.jar (509 kB at 9.6 MB/s)
02:25:13  [INFO] Uploading to ACD Snapshot Repository: http://triton.acdlon.com:8081/nexus/content/repositories/snapshots/cz/acdlon/b5/lgdn/dsa-web/1.3-SNAPSHOT/maven-metadata.xml
02:25:13  [INFO] Uploaded to ACD Snapshot Repository: http://triton.acdlon.com:8081/nexus/content/repositories/snapshots/cz/acdlon/b5/lgdn/dsa-web/1.3-SNAPSHOT/maven-metadata.xml (1.6 kB at 73 kB/s)
02:25:13  [INFO] Uploading to ACD Snapshot Repository: http://triton.acdlon.com:8081/nexus/content/repositories/snapshots/cz/acdlon/b5/lgdn/dsa-web/1.3-SNAPSHOT/dsa-web-1.3-20201121.012503-66-ear.war
02:25:17  [INFO] Uploaded to ACD Snapshot Repository: http://triton.acdlon.com:8081/nexus/content/repositories/snapshots/cz/acdlon/b5/lgdn/dsa-web/1.3-SNAPSHOT/dsa-web-1.3-20201121.012503-66-ear.war (88 MB at 21 MB/s)
02:25:17  [INFO] Uploading to ACD Snapshot Repository: http://triton.acdlon.com:8081/nexus/content/repositories/snapshots/cz/acdlon/b5/lgdn/dsa-web/1.3-SNAPSHOT/maven-metadata.xml
02:25:17  [INFO] Uploaded to ACD Snapshot Repository: http://triton.acdlon.com:8081/nexus/content/repositories/snapshots/cz/acdlon/b5/lgdn/dsa-web/1.3-SNAPSHOT/maven-metadata.xml (1.6 kB at 81 kB/s)

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题