Loading

Mule Maven Plugin fails during deploy/install with error: Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:3.0.0-M1:deploy

Date de publication: Oct 16, 2024
Résolution

SYMPTOM

Mule Maven plugin fails after issuing a "mvn deploy" command with the following error:
[INFO] ------------------------------------------------------------------------ 
[INFO] BUILD FAILURE 
[INFO] ------------------------------------------------------------------------ 
[INFO] Total time: 00.000 s 
[INFO] Finished at: 2018-10-01T00:00:00+01:00 
[INFO] Final Memory: xxM/xxM 
[INFO] ------------------------------------------------------------------------ 
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:3.0.0-M1:deploy (default-deploy) on project project-name:
 NoFileAssignedException: The packaging plugin for this project did not assign a main file to the project but it has attachments. Change packaging to 'pom'. -> [Help 1]
  Same error is showing for "mvn install":
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-install-plugin:3.0.0-M1:install (default-install) on project project-name:
 NoFileAssignedException: The packaging plugin for this project did not assign a main file to the project but it has attachments. Change packaging to 'pom'. -> [Help 1]

CAUSE

A new version of the Maven Install Plugin has been published on the Maven public repositories (3.0.0-M1).
By default, Mule doesn't define a version for this plugin and picks the last one. This new version fails at the install phase.

SOLUTION

Recommended solution:

If you are using Anypoint Studio to develop your project. Update mule.tools.version in your Project's pom.xml to version 1.7  
<mule.tools.version>1.7</mule.tools.version>
Please make sure this property is being used by the mule-app-maven-plugin plugin
<plugin>
	<groupId>org.mule.tools.maven</groupId>
	<artifactId>mule-app-maven-plugin</artifactId>
	<version>${mule.tools.version}</version>
	<extensions>true</extensions>
        ...
</plugin>

Or, if you are not using mule.tools.version property, you can modify mule-app-maven-plugin version directly :
<plugin>
	<groupId>org.mule.tools.maven</groupId>
	<artifactId>mule-app-maven-plugin</artifactId>
	<version>1.7</version>
	<extensions>true</extensions>
        ...
</plugin>

If after applying this solution you see the following error:
[ERROR] Unresolveable build extension: Plugin org.mule.tools.maven:mule-app-maven-plugin:1.7 or one of its dependencies could not be resolved: Could not find artifact org.mule.tools:mule-artifact-archiver:jar:1.2-SNAPSHOT @
that is a problem in the initial version of the fix that has now been updated. To correct execute the following Maven command from the project directory:
mvn dependency:purge-local-repository -DmanualInclude="org.mule.tools.maven:mule-app-maven-plugin:1.7"
That will remove the earlier version and the next build will use the updated release.


Alternative solution:
Instead of using the fixed version of the mule-app-maven-plugin, you can update the pom specifying the compatible Maven plugins version to be used explicitly: 
<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-install-plugin</artifactId>
    <version>2.5.2</version>
</plugin>
<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-deploy-plugin</artifactId>
    <version>2.8.2</version>
</plugin>
Numéro d’article de la base de connaissances

001117945

 
Chargement
Salesforce Help | Article