Skip to content

Latest commit

 

History

History
79 lines (64 loc) · 3.79 KB

customer-connector-upgrade.adoc

File metadata and controls

79 lines (64 loc) · 3.79 KB

Upgrading Java for Custom Connectors (Customers)

Note
This guide applies to MuleSoft customers only. If you are a MuleSoft partner, see partner-connector-upgrade.adoc.

Upgrade, test, and release your custom connectors for Java 17 to ensure compatibility within the MuleSoft ecosystem.

  • Minimum Mule version

    If your custom connector is running on Mule 4.5.x or earlier, you can’t run Java 17 tests that extend the MuleArtifactFunctionalTestCase, but you can still run Java 8 tests.

    To decouple the minimum Mule version when running tests, add the -Dmunit.jvm parameter to use Java 17 as described in Test Your Custom Connector with MUnit.

Test Your Custom Connector with MUnit

Run your MUnit tests to test compatibility of your connector against Java 17. Ensure your local JDK version is 17.

  1. Open the pom.xml file of your Mule app.

  2. Replace the mule-maven-plugin version with the ${mule.maven.plugin.version} parameter.

  3. If you haven’t already, add the munit-maven-plugin. Replace the version with the ${munit.version} parameter and replace runtimeVersion with the ${app.runtime} parameter.

    	<plugin>
    		<groupId>com.mulesoft.munit.tools</groupId>
    		<artifactId>munit-maven-plugin</artifactId>
    		<version>${munit.version}</version>
    		<executions>
    			<execution>
    				<id>test</id>
    				<phase>test</phase>
    				<goals>
    					<goal>test</goal>
    					<goal>coverage-report</goal>
    				</goals>
    			</execution>
    		</executions>
    		<configuration>
    			<coverage>
    				<runCoverage>true</runCoverage>
    				<formats>
    					<format>html</format>
    				</formats>
    			</coverage>
    			<runtimeVersion>${app.runtime}</runtimeVersion>
    			<dynamicPorts>
    				<dynamicPort>http.port</dynamicPort>
    			</dynamicPorts>
    		</configuration>
    	</plugin>
    Note
    MUnit 3.1 is compatible only with Mule runtime 4.3.0 and later. If your connector is compatible with Mule runtime 4.2.0 and earlier, you must create a legacy profile that overrides the MUnit version.
  4. If you have MUnit dependencies, such as munit-runner and munit-tools, replace the version for each dependency with the ${munit-version} parameter.

  5. Replace the version for each connector dependency with the Java 17 compatible version of the connector.

  6. Open a terminal window in the root of your Mule project and run the following command:

    mvn -f pom.xml -s ~/.m2/settings.xml -Dapp.runtime=4.6.0 -Dmunit.version=3.1.0 -Dmule.maven.plugin.version=4.1.0 -fae test

You can now see if your connector is compatible with Java 17. For more information about running MUnit tests, refer to MUnit.

The Mule runtime version you use determines the version of the mule-modules-parent. For example, if you use Mule runtime 4.6.0, you must use mule-modules-parent 1.6.0. Minor versions maintain a correspondence, such as Mule runtime 4.1.0 with mule-modules parent 1.1.0, Mule runtime 4.2.0 with mule-modules-parent 1.2.0, and so forth.

Java 17 is supported with Mule runtime 4.6.0 and later. However, a connector can be compatible with both Mule 4.3.0 and Java 17 simultaneously. If your connector must be compatible with Mule 4.3.0, its mule-modules-parent version cannot exceed 1.3.0. You do not necessarily need to use mule-modules-parent 1.6.0 for your connector to be compatible with Java 17. Using mule-modules-parent 1.6.0 is specifically required to leverage other features from the Mule runtime 4.6.0 in the connector.