[英]The parameters 'url' for goal org.apache.maven.plugins:maven-deploy-plugin:3.0.0-M1:deploy-file are missing or invalid
I'm using the maven-deploy-plugin
to deploy into Nexus an artifact generated by a task of maven-antrun-plugin
at the end of my build.我正在使用maven-deploy-plugin
maven-antrun-plugin
任务生成的工件部署到 Nexus 中。 The Ant task simply creates a file.sh of the assembled archive built by Maven. Ant 任务只需创建由 Maven 构建的组装档案的 file.sh。
I had to include maven-deploy-plugin
because otherwise the.sh is not uploaded into Nexus and it's completely ignored by the lifecycle of the build.我必须包括maven-deploy-plugin
因为否则 .sh 不会上传到 Nexus 并且它会被构建的生命周期完全忽略。
This is the plugin configuration I've tried:这是我尝试过的插件配置:
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<version>3.0.0-M1</version>
<configuration>
<skip>false</skip>
</configuration>
<executions>
<execution>
<id>deploy-sh</id>
<phase>deploy</phase>
<goals>
<goal>deploy-file</goal>
</goals>
<configuration>
<skip>false</skip>
<file>${project.build.directory}/${project.artifactId}-${project.version}-autoinstaller.sh</file>
<repositoryId>myrepo</repositoryId>
<groupId>${project.groupId}</groupId>
<artifactId>${project.artifactId}</artifactId>
<version>${project.version}</version>
</configuration>
</execution>
</executions>
</plugin>
I run the Maven build with mvn clean deploy
goals, but it fails with the following error:我使用mvn clean deploy
目标运行 Maven 构建,但它失败并出现以下错误:
[INFO] --- maven-deploy-plugin:3.0.0-M1:deploy-file (deploy-sh) @ MyApplication ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 04:11 min
[INFO] Finished at: 2020-05-01T19:07:40+02:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:3.0.0-M1:deploy-file (deploy-sh) on project MyApplication: The parameters 'url' for goal org.apache.maven.plugins:maven-deploy-plugin:3.0.0-M1:deploy-file are missing or invalid -> [Help 1]
The parameters 'url' for goal org.apache.maven.plugins:maven-deploy-plugin:3.0.0-M1:deploy-file are missing or invalid目标 org.apache.maven.plugins:maven-deploy-plugin:3.0.0-M1:deploy-file 的参数“url”丢失或无效
Yes, this occurs because there's not the <url>
tag in the section, so it's a mandatory parameter.是的,发生这种情况是因为该部分中没有<url>
标记,因此它是必需参数。
But why the <distributionManagement>
is completely ignored?但是为什么<distributionManagement>
被完全忽略了呢? I also have a distributionManagement configured for myrepo repository, so urls are configured there.我还为myrepo存储库配置了一个 distributionManagement,因此在那里配置了 url。
What I have to do to make it work within the distributionManagement for snapshots and releases ?我必须做些什么才能使其在 distributionManagement 中用于快照和发布?
Following this answer, I found the following solution:按照这个答案,我找到了以下解决方案:
maven-deploy-plugin
我已经完全删除了maven-deploy-plugin
<attachartifact>
ant task in the maven-antrun-plugin
我在maven-antrun-plugin
中添加了<attachartifact>
ant 任务In this way, the file produced by the Ant run plugin is correctly deployed to Nexus, as described here :这样,由 Ant 运行插件生成的文件正确部署到 Nexus,如下所述:
AttachArtifact Task附加工件任务
This task will attatch an artifact to the current Maven project.此任务会将工件附加到当前的 Maven 项目。 This is can be used to install and deploy an artifact generated by the Ant tasks.这可用于安装和部署由 Ant 任务生成的工件。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.