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.
The Ant task simply creates a file .sh of the assembled archive built by Maven.
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.
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:
[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
Yes, this occurs because there's not the <url>
tag in the section, so it's a mandatory parameter.
But why the <distributionManagement>
is completely ignored? I also have a distributionManagement configured for myrepo repository, so urls are configured there.
What I have to do to make it work within the distributionManagement for snapshots and releases?