-
Use the keyboard shortcuts:
-
Mac: Cmd+Shift+p
-
Windows: Ctrl+Shift+p
-
-
In the desktop IDE, select View > Command Palette.
-
In the cloud IDE, click the (menu) icon, and select View > Command Palette.
Exporting Mule Projects
Package a snapshot of Mule application resources in a shareable or deployable JAR file. A Mule application is an integration or implementation application that runs on Mule runtime engine.
-
A shareable JAR file is lightweight, packaging only the source code of the application. The source code includes configuration files but not libraries or other dependencies required for your application to run and deploy successfully.
The IDEs generate the dependencies automatically based on the settings in the POM file (
pom.xml
).You or your teammates can import the JAR file and continue developing in Anypoint Code Builder or Anypoint Studio (Studio).
-
A deployable JAR file contains the compiled code and all dependencies.
You can deploy the JAR file to any supported environment, such as CloudHub or on-premises.
To deploy a JAR file to CloudHub, see Deploy to CloudHub.
You don’t need to create a deployable JAR file to deploy to CloudHub. To deploy an app directly from Anypoint Code Builder, see Deploying Mule Apps to CloudHub.
Export to a Shareable JAR File
When you export a Mule project, the shareable JAR file includes these files:
-
The configuration XML and other files in the
src
folder, including resource files -
mule-artifact.json
-
pom.xml
To generate a shareable JAR file:
-
Open and place your cursor in the configuration XML file in a project for the Mule application to export.
-
Open the Command Palette.
Show me how
-
Select the following command:
MuleSoft: Export Mule Application Sources
This command is equivalent to the command sequence
Task: Run Task
>mule
>mule: Package Only Sources
.The terminal window in the IDE opens automatically to provide the status of the packaging process, which includes execution of the export command, a scan for the project to export, and the packaging of the project snapshot into a JAR file.
-
Find or download the JAR file by following the prompts that appear in the IDE after the packaging process completes successfully:
-
In the desktop IDE, click Open Folder to open the directory that contains the JAR file in the Explorer view.
The terminal window in the IDE also provides the path to the JAR, in the
/target
directory under your project folder. In the desktop IDE, you can find the JAR file in the Explorer view, in thetarget
folder and also under Java Projects: -
In the cloud IDE, click Download File to download the JAR file to a directory on your local machine:
-
For a JAR file that is 32 MB or smaller, the IDE automatically downloads the file to your Downloads folder.
-
For a JAR file that is larger than 32 MB, the IDE disallows downloads to built-in folders that contain system files, such as the Downloads, Desktop, or Documents folder.
-
Select a folder for the download.
-
At the prompt, click View files to allow the site to view the files in the folder you select.
-
Click Save Changes.
-
The terminal window in the IDE also provides the path to the JAR, in the
/target
directory under your project folder. -
-
The file name for the downloaded shareable JAR file follows the pattern application_name-version-SNAPSHOT-mule-application-light-package.jar
, for example, my-app-example-1.0.0-SNAPSHOT-mule-application-light-package.jar
.
To open a shareable JAR file in a project workspace within Anypoint Code Builder, see Import a Shareable Project JAR File into the Desktop IDE and Import a Shareable Project JAR File into the Cloud IDE.
Export to a Deployable JAR File
When you export a Mule project, Anypoint Code Builder packages the compiled code and all dependencies into a distributable JAR.
Deployment procedures vary by Mule runtime host and deployment mechanism. For example, you can deploy to CloudHub through the Runtime Manager UI or REST API. For more information, see Runtime Plane Hosting Options and Deploy Mule Applications.
To generate a deployable JAR file:
-
Open and place your cursor in the configuration XML file in a project for the Mule application to export.
-
Open the Command Palette.
Show me how
-
Use the keyboard shortcuts:
-
Mac: Cmd+Shift+p
-
Windows: Ctrl+Shift+p
-
-
In the desktop IDE, select View > Command Palette.
-
In the cloud IDE, click the (menu) icon, and select View > Command Palette.
-
-
Select the following command:
MuleSoft: Export Project to Mule Deployable Jar
This command is equivalent to the command sequence
Task: Run Task
>mule
>mule: Package
.The terminal window in the IDE opens automatically to provide the status of the packaging process, which includes the execution of the export command, a scan for the project to export, and the packaging of the project snapshot into a JAR file.
-
Find or download the JAR file by following the prompts that appear in the IDE after the packaging process completes successfully:
-
In the desktop IDE, click Open Folder to open the directory that contains the JAR file in the Explorer view.
The terminal window in the IDE also provides the path to the JAR, in the
/target
directory under your project folder. In the Desktop IDE, you can find the JAR file in the Explorer, under Java Projects:-
In the cloud IDE, click Download File to download the JAR file to a directory on your local machine.
-
For a JAR file that is 32 MB or smaller, the IDE automatically downloads the file to your Downloads folder.
-
For a JAR file that is larger than 32 MB, the IDE disallows downloads to built-in folders that contain system files, such as the Downloads, Desktop, or Documents folder.
-
Select a folder for the download.
-
At the prompt, click View files to allow the site to view the files in the folder you select.
-
Click Save Changes.
-
-
-
-
The file name for the downloaded deployable JAR file follows the pattern application_name-version-SNAPSHOT-mule-application.jar
, for example: my-app-example-1.0.0-SNAPSHOT-mule-application.jar
.