简体   繁体   English

目标 org.apache.maven.plugins:maven-deploy-plugin:3.0.0-M1:deploy-file 的参数“url”丢失或无效

[英]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:按照这个答案,我找到了以下解决方案:

  1. I have removed completely the maven-deploy-plugin我已经完全删除了maven-deploy-plugin
  2. I have added <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.

相关问题 错误:无法执行目标org.apache.maven.plugins:maven-deploy-plugin:2.8.2:deploy 405, - ERROR: Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.8.2:deploy 405, [error]无法执行目标org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy - [error]Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy 未能执行目标 org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy Github 包 - Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy Github Packages 警告 org.apache.maven.plugins:maven-deploy-plugin 的“build.plugins.plugin.version”丢失 - WARNING 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-deploy-plugin is missing 目标org.apache.maven.plugins的执行default-deploy:maven-deploy-plugin部署失败。 空指针异常 - Execution default-deploy of goal org.apache.maven.plugins:maven-deploy-plugin deploy failed. NullPointerException Maven构建错误:无法在目标Pluto上执行目标org.apache.maven.plugins:maven-deploy-plugin:2.5:部署(default-deploy) - Maven build error: failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.5: deploy (default-deploy) on project pluto 无法执行目标org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy-当Maven处于脱机模式时,无法部署工件 - Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy - Cannot deploy artifacts when Maven is in offline mode 从命令行运行 Maven 时“无法执行目标 org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M1:test (default-test)” - " Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M1:test (default-test)" while running Maven from command line Maven部署-&gt;错误org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy失败,但是在pom中没有提到插件? - Maven deploy -> error org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy fails, but no mention of plugin in pom? 无法加载 mojo &#39;test&#39; - org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M1:test - Unable to load the mojo 'test' - org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M1:test
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM