Maven部署了两次



我遇到一个问题,当我运行时,我的工件部署了两次

mvn deploy
[INFO] --- maven-deploy-plugin:2.8.2:deploy-file (deploy-file) @ 1.0 ---
Uploading to ProductSuite: http://abc.123:8081/nexus/repository/ProductSuite/Dev/Release/webUI/1.0/https/1.0-https.zip
Uploaded to ProductSuite: http://abc.123:8081/nexus/repository/ProductSuite/Dev/Release/webUI/1.0/https/1.0-https.zip (334 MB at 8.1 MB/s)
Uploading to ProductSuite: http://abc.123:8081/nexus/repository/ProductSuite/Dev/Release/webUI/1.0/https/1.0-https.pom
Uploaded to ProductSuite: http://abc.123:8081/nexus/repository/ProductSuite/Dev/Release/webUI/1.0/https/1.0-https.pom (423 B at 795 B/s)
Downloading from ProductSuite: http://abc.123:8081/nexus/repository/ProductSuite/Dev/Release/webUI/1.0/maven-metadata.xml
Downloaded from ProductSuite: http://abc.123:8081/nexus/repository/ProductSuite/Dev/Release/webUI/1.0/maven-metadata.xml (310 B at 1.5 kB/s)
Uploading to ProductSuite: http://abc.123:8081/nexus/repository/ProductSuite/Dev/Release/webUI/1.0/maven-metadata.xml
Uploaded to ProductSuite: http://abc.123:8081/nexus/repository/ProductSuite/Dev/Release/webUI/1.0/maven-metadata.xml (336 B at 614 B/s)
Uploading to ProductSuite: http://abc.123:8081/nexus/repository/ProductSuite/Dev/Release/webUI/1.0/https/1.0-https.zip
Uploaded to ProductSuite: http://abc.123:8081/nexus/repository/ProductSuite/Dev/Release/webUI/1.0/https/1.0-https.zip (334 MB at 7.2 MB/s)

在查找了一些修复程序后,我发现了一个潜在的修复程序:

我只需要在maven组装插件中添加以下内容

<attach>false</attach>
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  01:04 min
[INFO] Finished at: 2021-01-05T16:10:44-05:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-install-plugin:2.4:install (default-install) on project 11.8: The packaging for this project did not assign a file to the build artifact -> [Help 1]
[ERROR]

以下是我目前正在处理的内容。它在没有连接配置的情况下工作,但在连接配置中失败。

非常感谢您的帮助。谢谢

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>Dev.Release.productA</groupId>
<artifactId>11.8</artifactId>
<version>https</version>
<url>https://maven.apache.org</url>
<properties>
<COMPANYRepositoryUrl>http://abc.123:8081/nexus</COMPANYRepositoryUrl>
<product>productA</product>
</properties>
<distributionManagement>
<repository>
<id>PROD</id>
<url>${PRODRepositoryUrl}/repository/PROD/</url>
</repository>
</distributionManagement>
<!--
| Where to deploy our built artifacts.
+ -->
<build>
<!--
| Define versions of plugins to ensure stable builds.
+
-->
<plugins>
<!--
| Standard maven plugins.
| Note: enforcer plugin is used (initialize) to ensure all plugins are versioned
| Or use $ mvn enforcer:enforce" to check
| Note: to check on the latest version of plugins available do:
| $ mvn versions:display-plugin-updates
+ -->

<plugin>
<artifactId>maven-install-plugin</artifactId>
<version>3.0.0-M1</version>
<executions>
<execution>
<id>default-install</id>
<phase>none</phase>
<configuration>
<file>${basedir}/target/${project.artifactId}-${project.version}.zip</file>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<version>3.0.0</version>            
<executions>
<execution>
<id>default-jar</id>
<phase>none</phase>
<configuration>
<finalName>unwanted</finalName>
<classifier>unwanted</classifier>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>3.0.0-M1</version>
<executions>
<!-- disable standard deploy -->
<execution>
<id>default-deploy</id>
<phase>none</phase>
</execution>
<execution>
<phase>deploy</phase>
<configuration>
<file>${basedir}/target/${project.artifactId}-${project.version}.zip</file>
<repositoryId>TEST</repositoryId>
<groupId>${project.groupId}</groupId>
<artifactId>${project.artifactId}</artifactId>
<version>${project.version}</version>
<url>${COMPANYRepositoryUrl}/repository/TEST/</url>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.3.0</version>
<configuration>
<appendAssemblyId>false</appendAssemblyId>
<attach>false</attach>
<descriptors>
<descriptor>src/main/assembly/zip.xml</descriptor>
</descriptors>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
<id>zip</id>
<includeBaseDirectory>false</includeBaseDirectory>
<formats>
<format>zip</format>
</formats>
<files>
<file>
<source>C:PATHtowebui.exe</source>
<outputDirectory>/</outputDirectory>
</file>
</files>
</assembly>

我不得不在maven安装插件的默认执行中添加一个部分。我可以在不重复上传的情况下运行mvn-deploy,这节省了一分钟的部署时间。(我还将一些插件更新到了新版本(

<plugin>
<artifactId>maven-install-plugin</artifactId>
<version>3.0.0-M1</version>
<executions>
<execution>
<id>default-install</id>
<phase>none</phase>
<configuration>
<file>${basedir}/target/${project.artifactId}-${project.version}.zip</file>
</configuration>
</execution>
</executions>
</plugin>

最新更新