Background: I have a EJB application which runs on java 1.7 and we are using maven 3+ version for building the code.
Issue: When I build this code I am getting java version mismatch issue i.e major and minor issue.
Error:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-install-plugin:3.1.0:install (default-install) on project XYZ: Execution default-install of goal org.apache.maven.plugins:maven-install-plugin:3.1.0:install failed: Unable to load the mojo 'install' in the plugin 'org.apache.maven.plugins:maven-install-plugin:3.1.0' due to an API incompatibility: org.codehaus.plexus.component.repository.exception.ComponentLookupException: org/apache/maven/plugins/install/InstallMojo : Unsupported major.minor version 52.0
[ERROR] realm = plugin>org.apache.maven.plugins:maven-install-plugin:3.1.0
[ERROR] strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
[ERROR] urls[0] = file:/C:/Users/A/.m2/repository/org/apache/maven/plugins/maven-install-plugin/3.1.0/maven-install-plugin-3.1.0.jar
[ERROR] urls[1] = file:/C:/Users/A/.m2/repository/org/eclipse/aether/aether-util/1.0.0.v20140518/aether-util-1.0.0.v20140518.jar
[ERROR] urls[2] = file:/C:/Users/A/.m2/repository/org/codehaus/plexus/plexus-utils/3.3.0/plexus-utils-3.3.0.jar
[ERROR] Number of foreign imports: 1
[ERROR] import: Entry[import from realm ClassRealm[project>com.test:XYZ:9.0.5-SNAPSHOT, parent: ClassRealm[maven.api, parent: null]]]
Java Version : 1.7 Maven Version : 3.8.6
FYI: I don't want to change the java version
Things I have already checked:
- Cleared .m2 folders and build.
- Checked java version it's pointing to 1.7
- Checked java compilation version and it's pointing to 1.7
- Checked the maven version and it's java version which it is pointing to and the version is 1.7
maven-install-plugin3.1.0 requires Java 8. You need to switch to an earlier version, like 3.0.1.