Issue
I am trying to deploy my mule project from Anypoint using terminal "mvn clean package deploy-DmuleDeploy" command. I am not sure what this error is saying but i'm sure it has to do with my maven version. I've installed maven on my mac using homebrew, but it is version 3.8.6. The "embedded maven installation" under preferences-AnypointStudio-maven in Anypoint says 3.6.3. Then the plugin version on my .pom file says 3.5.4. Do i need to change any of these versions? Should i edit the one in the .pom file? Should i downgrade my mac maven version? Any help would be appreciated. I've posted a partial error and a partial .pom file. Please let me know if you need any more info to help me. Thank you
> [ERROR] Failed to execute goal org.mule.tools.maven:mule-maven-plugin:3.5.4:process-sources (default-process-sources) on project maven: Execution default-process-sources of goal org.mule.tools.maven:mule-maven-plugin:3.5.4:process-sources failed: An API incompatibility was encountered while executing org.mule.tools.maven:mule-maven-plugin:3.5.4:process-sources: java.lang.IllegalAccessError: class org.mule.maven.client.internal.util.FileUtils (in unnamed module @0x6d9fb2d1) cannot access class sun.net.www.protocol.jar.JarURLConnection (in module java.base) because module java.base does not export sun.net.www.protocol.jar to unnamed module @0x6d9fb2d1
[ERROR] -----------------------------------------------------
[ERROR] realm = extension>org.mule.tools.maven:mule-maven-plugin:3.5.4
[ERROR] strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
[ERROR] urls[0] = file:/Users/ammanbesaw/.m2/repository/org/mule/tools/maven/mule-maven-plugin/3.5.4/mule-maven-plugin-3.5.4.jar
Pom file
> <?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.mycompany</groupId>
<artifactId>maven</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>mule-application</packaging>
<name>maven</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<app.runtime>4.4.0-20220523</app.runtime>
<mule.maven.plugin.version>3.5.4</mule.maven.plugin.version>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-clean-plugin</artifactId>
<version>3.0.0</version>
</plugin>
<plugin>
<groupId>org.mule.tools.maven</groupId>
<artifactId>mule-maven-plugin</artifactId>
<version>3.5.4</version>
<extensions>true</extensions>
Solution
The cause of the error seems to be that Maven is using a Java/JDK version that is not supported by Mule. Only Java/JDK versions 8 and 11 are supported. Ensure that Maven is executing a supported JDK version.
Answered By - aled
Answer Checked By - Robin (JavaFixing Admin)