In Manage Jenkins > Plugins menu, at the minimum, you need to download:

  • maven
  • Config File Provider
  • Persistent Choice
  • Copy Project

In the Manage Jenkins > Manage Tools menu, you will need to install and configure a few things:

  • JDK (Remember that current versions of mule support only up to JDK8u151
  • Maven
  • Git

At this time, for testing you can put your personal GitHub credentials in, or create a service account, like ‘svc_jenkins’ for github usage.

Config File Provider plugin
To create Mule builds, especially building with Enterprise Mule you will have to customize your Maven Settings file. The Config File Provider plugin allows you to do that. If you have an Enterprise Supported Account you’ll need to contact your support and ask for Enterprise Repository credentials to be created for you.

Use the config file provider to setup a file much like:
https://docs.mulesoft.com/mule-user-guide/v/3.9/configuring-maven-to-work-with-mule-esb

The maven File I’m using for my basic Jenkins jobs is:

<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 
          http://maven.apache.org/xsd/settings-1.0.0.xsd">
  <pluginGroups>
    <pluginGroup>org.mule.tools</pluginGroup>
  </pluginGroups>
  <servers>
    <server>
      <id>MuleRepository</id>
      <username>yourcompany.nexus</username>
      <password>abc123</password>
    </server>
  </servers>
  <profiles>
    <profile>
      <id>Mule</id>
      <activation>
        <activeByDefault>true</activeByDefault>
      </activation>
      <properties>
        <anypoint.username>anypoint.username</anypoint.username>
        <anypoint.password>abc123</anypoint.password>
      </properties>
      <repositories>
        <repository>
          <id>MuleRepository</id>
          <name>MuleRepository</name>
          <url>https://repository.mulesoft.org/nexus-ee/content/repositories/releases-ee/</url>
          <layout>default</layout>
          <releases>
            <enabled>true</enabled>
          </releases>
          <snapshots>
            <enabled>true</enabled>
          </snapshots>
        </repository>
        <repository>
          <id>mulesoft-releases</id>
          <name>MuleSoft Repository</name>
          <url>http://repository.mulesoft.org/releases/</url>
          <layout>default</layout>
        </repository>
        <repository>
          <id>mulesoft-snapshots</id>
          <name>MuleSoft Snapshot Repository</name>
          <url>http://repository.mulesoft.org/snapshots/</url>
          <layout>default</layout>
        </repository>
      </repositories>
    </profile>
  </profiles>
</settings>

There are two pieces in here you will have to configure:

  1. Your Mulesoft Enterprise Repository
  2. Your Anypoint Username/Password
Your Maven POM
The Maven POM that you need to use adds two critical plugins that allow for deployment to Anypoint Platform

<plugin>
  <!-- https://docs.mulesoft.com/mule-user-guide/v/3.9/mule-maven-plugin#cloudhub -->
  <groupId>org.mule.tools.maven</groupId>
  <artifactId>mule-maven-plugin</artifactId>
  <version>2.2.1</version>
  <configuration>
    <applicationName>${project.artifactId}-${mule.env}</applicationName>
    <deploymentType>cloudhub</deploymentType>
    <muleVersion>${mule.version}</muleVersion>
    <username>${anypoint.username}</username>
    <password>${anypoint.password}</password>
    <redeploy>true</redeploy>
    <environment>${mule.env}</environment>
    <properties>
      <mule.env>${mule.env}</mule.env>
    </properties>
    <region>us-east-1</region>
    <workerType>${mule.workerType}</workerType>
    <workers>${mule.workers}</workers>
  </configuration>
  <executions>
    <execution>
      <id>deploy</id>
      <phase>deploy</phase>
      <goals>
        <goal>deploy</goal>
      </goals>
    </execution>
  </executions>
</plugin>
<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-deploy-plugin</artifactId>
  <version>2.8.2</version>
  <configuration>
    <skip>true</skip>
  </configuration>
</plugin>