=====================================================
Adobe Experience Manager (AEM) builds can sometimes fail due to Java version conflicts. In this article, we will explore a common issue where the aQute/bnd/osgi/Analyzer
has been compiled by a more recent version of the Java Runtime, causing build failures.
The error message indicates that the aQute/bnd/osgi/Analyzer
has been compiled by a more recent version of the Java Runtime (class file version 61.0), which is not compatible with the current Java Runtime version (up to 55.0). This issue can occur when using Cloud Manager or building locally.
The error can be caused by:
maven-bundle-plugin
version that is not compatible with the current Java Runtime version.pom.xml
file or settings.xml
file.maven-bundle-plugin
VersionTo resolve the issue, update the maven-bundle-plugin
version to 5.1.9 or lower in the parent pom.xml
file:
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>5.1.4</version>
<extensions>true</extensions>
<configuration>
<instructions>
<Bundle-SymbolicName>com.xxx.xxx</Bundle-SymbolicName>
<Sling-Model-Packages>
com.xxxx.models
</Sling-Model-Packages>
<!-- <Embed-Dependency>json|nimbus-jose-jwt|tink;scope=compile;inline=true</Embed-Dependency> -->
<Embed-Dependency>json</Embed-Dependency>
</instructions>
</configuration>
</plugin>
pom.xml
FileAlternatively, specify the correct Java version in the pom.xml
file:
<properties>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
</properties>
If building with Cloud Manager, use the Maven Tool Chain plugin to specify the Java version:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-toolchains-plugin</artifactId>
<version>3.0.0</version>
<configuration>
<toolchains>
<jdk>
<version>11</version>
</jdk>
</toolchains>
</configuration>
</plugin>
Resolving Java version conflicts in AEM builds requires careful attention to the maven-bundle-plugin
version, Java version specification in pom.xml
files, and the use of the Maven Tool Chain plugin. By following these solutions, you can ensure successful builds and avoid errors caused by Java version incompatibilities.