Skip to content

Maven

Authentication

Username / Password will require MFA as described in this article,

Use interactive login using CLI (emt login) for user authentication, or connected apps for CI/CD

Proxy Settings

If you need to use a proxy, set your proxy settings in settings.xml as described here

Common properties

The following properties are common across maven goals.

Name Property Description
org emt.org Organization Name
env emt.env Environment Name
clientId emt.auth.client.id Anypoint authentication client id
clientSecret emt.auth.client.secret Anypoint authentication client secret
bearer emt.auth.bearer Anypoint authentication bearer token
username emt.auth.username Anypoint Username
password emt.auth.password Anypoint Password

Goals List

The maven plugin supports the following goals:

Name Description Authenticated Default Phase
process-descriptor Process an application's anypoint descriptor and include in project No generate-resources
provision Provision anypoint Yes install
deploy Deploy an a mule application through Anypoint Runtime Manager Yes deploy
promote Promote an exchange mule application snapshot version o a release version Yes

process-descriptor

You MUST run this goal when building your mule application. This will read an anypoint.json/yml/yaml file, process it and generate a new anypoint.json file that is added to your project's generated resources folder, as well as attached as an maven artifact with a classifier anypoint-descriptor.

Name Property Required Default Description
descriptor anypoint.descriptor No Descriptor file path
mulePluginCompatibility muleplugin.compat false Must be set to true to use standard mule plugin to deploy
attachDescriptor anypoint.descriptor.attach true No Attaches the descriptor to the maven project (don't change this unless you're using provisioning goal or have a really good reason to do so)

deploy

The deploy goal of the maven plugin supports the following parameters for both pom-based and standalone usage.

  • Name: name of the parameter when settings it in the <configuration> section of the pom.xml
  • Property: name of the property used to set the parameter (this is the only way to set parameters when using the standalone invocation)
  • Description: Description of the parameter
  • Required: If the parameter is required
Name Property Required Description
skipProvisioning emt.provisioning.skip No If set to true, automatic Infrastructure provisioning will be skipped
skipDeploy emt.deploy.skip No If set to true, the deployment will be skipped
file emt.app.file No File path of application archive
filename emt.app.filename No File name of application archive (if not set, the file name of the archive will be used)
appName emt.app.name No Application name ( default: ${artifactId}-${anypoint.env} )
force anypoint.deploy.force No If true, will force deployment even if same already application was already deployed.
skipWait anypoint.deploy.skipwait No If true will skip wait for application to start
deployTimeout anypoint.deploy.timeout No Deployment timeout in milliseconds ( defaults to 10 min)
deployRetryDelay anypoint.deploy.retrydelay No Delay (in milliseconds) in retrying a deployment ( defaults to 2.5 seconds )
propertyfile emt.deploy.properties.file No Application Properties stored in a property file, that will be set in Runtime Manager
fileProperties No Properties that will be injected in a property file in the project's archive at deploy time (rather than in Runtime Manager)
filePropertiesPath No Path of the property file (inside the application jar) for properties set in fileProperties
filePropertiesSecure No If set to true, all secure properties will be moved into fileProperties rather than properties
buildNumber anypoint.deploy.buildnumber No Is this is specified, the provided build number is used as a suffix to SNAPSHOT versions published to exchange
deleteSnapshots emt.provisioning.deletesnapshots No If this is set to true, and a snapshot is deployed to RTF, older snapshots will be deleted
anypointPlatformUrl anypoint.url No Anypoint platform base URL
emt.target No Deployment target ( cloudhub, cloudhub2:[targetId], exchange, rtf:[targetId], or hybrid:[targetName]
properties emt.property.[propertyname] No Application Properties that will be set in Runtime Manager (note this must be in the form of a maven properties )
emt.secureproperty.[propertyname] No add property to secure list if value is true
vars No Variables for anypoint.json templating
emt.var.[varname] No Override a variable
emt.defaults.[parampath] No Add defaults layer value (see below for details)
emt.overrides.[parampath] No Add over layer value (see below for details)
emt.env.[envNameOrId].[property] No Add environment-specific layer value (see below for details)
emt.envtype.[envType].[property] No Add environment type-specific layer value (see below for details)

It is possible to set default or override values for any element of anypoint.json using emt.defaults.*, emt.overrides.*

For example, let's say you want to specify that the default number of replicas when deploying to cloudhub2 is 2, you can do that using setting property emt.defaults.deploymentParams.cloudhub2.replicas to 2.

Since this is a default, it will only be used if the anypoint.json does NOT define a value.

On the other hand, if you want to override the value (so that it's used even if defined in anypoint.json), then you can use emt.overrides.deploymentParams.cloudhub2.replicas to 2.

It's also possible use the emt.env.* and ent.envtype.* to override properties only when deploying to a specific environment or environment type. When this is used and it matches the environment, the prefix emt.env.*[envNameOrId]*. ir replace with just emt.

So for example, let's say you want to override the replicas but only the environment Sandbox, you can then just use the property emv.env.sandbox.overrides.deploymentParams.cloudhub2.replicas

provision

This goal is used to only perform the anypoint provisioning (without the deployment), and set properties for you use in conjunction with the standard mule plugin.

Doing deployment using just provisioning has the downside of losing some capabilities, but on the upside it allows to use the mule plugin to do provisioning which in some scenarios might be a better approach (for example if you want to deploy to RTF which isn't yet supported by this plugin).

Name Property Required Description
skipApiProvisioning anypoint.api.provisioning.skip No If set to true, automatic API Manager provisioning will be skipped
vars No Variables for anypoint.json templating

After the plugin runs, the following maven properties will be set

Property Description
anypoint.api.id API Id
anypoint.api.client.id API client application id (if client provisioning is set
anypoint.api.client.secret API client application secret (if client provisioning is set
anypoint.platform.client_id Client id for anypoint environment
anypoint.platform.client_secret Client secret for anypoint environment (this will be only set if the user has the required access)

Important note: Due how weirdly the mule maven plugin is implemented, you will need to set process-descriptor to false.

Example configuration to deploy an application to cloudhub using provisioning-only

<build>
    <plugins>
        <plugin>
            <groupId>com.aeontronix.enhanced-mule</groupId>
            <artifactId>enhanced-mule-tools-maven-plugin</artifactId>
            <version>1.1.0</version>
            <executions>
                <execution>
                    <goals>
                        <goal>process-descriptor</goal>
                        <goal>provision</goal>
                    </goals>
                </execution>
            </executions>
            <configuration>
                <attachDescriptor>false</attachDescriptor>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.mule.tools.maven</groupId>
            <artifactId>mule-maven-plugin</artifactId>
            <version>${mule.maven.plugin.version}</version>
            <extensions>true</extensions>
            <executions>
                <execution>
                    <id>deploy</id>
                    <phase>deploy</phase>
                    <goals>
                        <goal>deploy</goal>
                    </goals>
                </execution>
            </executions>
            <configuration>
                <cloudHubDeployment>
                    <uri>https://anypoint.mulesoft.com</uri>
                    <muleVersion>${app.runtime}</muleVersion>
                    <username>${username.username}</username>
                    <password>${password.password}</password>
                    <applicationName>anypointtoolsdemo-provisiononly-${anypoint.env}</applicationName>
                    <environment>${anypoint.env}</environment>
                    <region>us-west-2</region>
                    <workers>1</workers>
                    <workerType>MICRO</workerType>
                    <properties>
                        <anypoint.api.id>${anypoint.api.id}</anypoint.api.id>
                        <anypoint.api.client.id>${anypoint.api.client.id}</anypoint.api.client.id>
                        <anypoint.api.client.secret>${anypoint.api.client.secret}</anypoint.api.client.secret>
                        <anypoint.platform.client_id>${anypoint.platform.client_id}</anypoint.platform.client_id>
                        <anypoint.platform.client_secret>${anypoint.platform.client_secret}
                        </anypoint.platform.client_secret>
                        <skipDeploymentVerification>true</skipDeploymentVerification>
                    </properties>
                </cloudHubDeployment>
            </configuration>
        </plugin>
    </plugins>
</build>

promote

This goal will retrieve a mule application snapshot from exchange and then will:

  • Modify its version ( including in all the locations where the version is used inside the application archive )
  • Publish the modified archive with the new version
  • Delete all snapshots with the same base version ( the part before -SNAPSHOT )
Property Required Description
groupId No application exchange group id
artifactId Yes application exchange artifact id
version Yes Application exchange snapshot version to promote
newVersion No New version for the application ( defaults to same version with the -SNAPSHOT part removed )