Contact Us 1-800-596-4880

Exporting Mule Projects

logo cloud IDE Cloud IDE

logo desktop IDE Desktop IDE

Open Beta Release: The cloud IDE is in open beta. Any use of Anypoint Code Builder in its beta state is subject to the applicable beta services terms and conditions, available from the IDE.

A Mule application is an integration or implementation application that runs on Mule runtime engine. To share the application across different teams, or to deploy the application elsewhere, you can export and package a snapshot of Mule application resources. Additionally, you can publish a Mule project to Exchange as either a template or an example.

  • 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 and CloudHub 2.0.

  • A publishable Mule project template or example contains resources to share the project via Anypoint Exchange.

    You or your teammates can import the Mule project from Exchange and continue developing in Anypoint Code Builder or Studio.

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:

  1. Open and place your cursor in the configuration XML file in a project for the Mule application to export.

  2. 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.

  3. Select the following command:

    MuleSoft: Export Shareable JAR

    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.

  4. 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.

    • 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.

        1. Select a folder for the download.

        2. At the prompt, click View files to allow the site to view the files in the folder you select.

        3. 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:

  1. Open and place your cursor in the configuration XML file in a project for the Mule application to export.

  2. 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.

  3. 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.

  4. 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:

      Deployable JAR file in the Java Projects folder
      • 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.

          1. Select a folder for the download.

          2. At the prompt, click View files to allow the site to view the files in the folder you select.

          3. 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.

Publish a Mule Project to Exchange

You can publish a project as either a template or an example.

A project template is a pre-configured, reusable project setup that serves as a starting point for developing Mule applications. These templates provide a structured framework that includes common configurations, example code, and best practices.

A project example is a sample application that demonstrates specific functionalities or use cases. These examples provide practical, real-world scenarios to help developers implement various features and integrations.

To publish a Mule project to Exchange as either a template or an example:

  1. In Anypoint Code Builder, on the Explorer view, right-click on your root XML file, for example, /src/main/mule/flights-implementation.xml.

  2. Select Publish Mule Project to Exchange from the options menu.

  3. In the Publish to Exchange form, select an Asset Type.

    Select either an Example or a Template.

  4. Ensure that the following fields contain the correct values for your asset:

    Form for publishing a project to Exchange
    Field Name Field Value

    Asset Name

    Name that Exchange uses to identify the published project.

    Version

    Version number to display in the Version section of the page that Exchange creates for the asset.

    If you are publishing the asset for the first time, you can use any valid number. A typical starting version is 1.0.0.

    If you are republishing the asset, Anypoint Code Builder automatically populates the Version field. You can change this number, but the republish fails if you use a version number that has already been used to publish a stable version of this asset.

    Description

    Optional description of your asset.

    Business Group

    Business unit in Anypoint Platform that the asset belongs to.

    Group ID

    ID of the business unit in Anypoint Platform that the asset belongs to.

    Artifact ID

    Unique ID that Exchange uses to identify the published asset. Use the default value unless a published asset has the same ID.

  5. In Advanced Options, make sure that these fields contain the correct values for your asset:

    Form for publishing a project to Exchange
    Field Name Field Value

    Tags

    Descriptors that Exchange uses to search for assets.

    Categories

    Category that was previously added to Exchange. Refer to the Manage Categories documentation to learn how to create Categories for your organization.

  6. In Advanced Options, select the Keep your local and published project in sync checkbox to sync your local project information with the data you entered. If deselected, your project deploys with the provided data, but your local project doesn’t include the updated information.

  7. Click Publish.

The publication of your project as a new asset begins. After publication succeeds, select View Asset to view the asset in Exchange.