Mule Maven Plugin & Deployments to Standalone Mule Instances
This is an issue I encountered recently whilst trying enable automated deployments to a local instance of Mulesoft EE Edition v3.8.3 and could not find any solution on the web. I am documenting it here in case anyone else faces the same issue and is looking for a solution.
The mule-maven-plugin is unable to copy the application ZIP file to the apps directory.
To resolve, follow the steps below.
1. Use mule mule-app-maven-plugin to build the application - set the flag copyToAppsDirectory to false.
<plugin>
<groupId>org.mule.tools.maven</groupId>
<artifactId>mule-app-maven-plugin</artifactId>
<version>${mule.tools.version}</version>
<extensions>true</extensions>
<configuration>
<copyToAppsDirectory>false</copyToAppsDirectory>
</configuration>
</plugin>
2. Add a plugin to copy the generated artifact to MULE_HOME/apps folder. This is done using the maven-dependency-plugin. This is added after the mule maven plugin section of the POM.
3. Disable the default execution of the maven deploy plugin to prevent deploying the generated artifact to an external repository.
The mule-maven-plugin is unable to copy the application ZIP file to the apps directory.
To resolve, follow the steps below.
1. Use mule mule-app-maven-plugin to build the application - set the flag copyToAppsDirectory to false.
<plugin>
<groupId>org.mule.tools.maven</groupId>
<artifactId>mule-app-maven-plugin</artifactId>
<version>${mule.tools.version}</version>
<extensions>true</extensions>
<configuration>
<copyToAppsDirectory>false</copyToAppsDirectory>
</configuration>
</plugin>
2. Add a plugin to copy the generated artifact to MULE_HOME/apps folder. This is done using the maven-dependency-plugin. This is added after the mule maven plugin section of the POM.
<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-dependency-plugin</artifactId> <version>2.10</version> <executions> <execution> <id>copy</id> <phase>deploy</phase> <goals> <goal>copy</goal> </goals> <configuration> <artifactItems> <artifactItem> <groupId>com.mycompany</groupId> <artifactId>order-system</artifactId> <version>1.0.0-SNAPSHOT</version> <type>zip</type> <overWrite>false</overWrite> <outputDirectory>C:/mule-home/apps</outputDirectory> <destFileName>order-system-1.0.0-SNAPSHOT.zip</destFileName> </artifactItem> </artifactItems> <overWriteReleases>false</overWriteReleases> <overWriteSnapshots>true</overWriteSnapshots> </configuration> </execution> </executions> </plugin>
3. Disable the default execution of the maven deploy plugin to prevent deploying the generated artifact to an external repository.
<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-deploy-plugin</artifactId> <version>2.8.2</version> <configuration> <skip>true</skip> </configuration> </plugin>
This comment has been removed by the author.
ReplyDeleteYou made some good points here. I did a search on the and MuleSoft found most people will agree with this. Also Visit this site for to learn more about MuleSoft Online Training.
ReplyDeleteThank you for sharing wonderful information with us to get some idea about it.
ReplyDeletemule 4 training
learn mulesoft
Nice article. Thank you for sharing.
ReplyDeleteMulesoft Training
Nice post ,The Mule Maven Plugin is a tool that facilitates the deployment of Mule applications using Maven, a popular build automation and project management tool. This plugin streamlines the process of building and deploying Mule applications by integrating with your Maven project.
ReplyDelete