Build fails: aQute/bnd/osgi/Analyzer has been compiled by a more recent version of the Java Runtime (class file version 61.0), | Community
Skip to main content
Level 6
December 2, 2024
Solved

Build fails: aQute/bnd/osgi/Analyzer has been compiled by a more recent version of the Java Runtime (class file version 61.0),

  • December 2, 2024
  • 1 reply
  • 5443 views

WARNING] Error injecting: org.apache.felix.bundleplugin.BundlePlugin
java.lang.UnsupportedClassVersionError: aQute/bnd/osgi/Analyzer has been compiled by a more recent version of the Java Runtime (class file version 61.0), this version of the Java Runtime only recognizes class file versions up to 55.0

 

hi folks,

 

I recently started getting these messages while my AEM 6.5 build error.

 

My JDK is 11.

 

Where did the aQute/bnd/osgi/Analyzer in  Java 17 come from?

 

Any ideas?

 

thanks Fiona

 

Best answer by narendragandhi

I don't know how to change the version  of  org.apache.felix   maven-bundle-plugin .

 

 

I configure it, but it has no version.

 

It is coming from somewhere and is in my .m2/repository/org/apache/felix/

which has jar files from felix-parent, utils, scr.generator, scr.annotations,maven-bundle-plugin, bundlerepository,

maven-scr-plugin...


Looking at the change log of maven-bundle-plugin - https://github.com/apache/felix-dev/blob/master/tools/maven-bundle-plugin/changelog.txt

 

The latest release 6.0.0 needs minimum java 17 so to resolve the issue you would need to update the maven-bundle-plugin to 5.1.9 or lower in the parent pom.xml. 

 

<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>

 

Also if you are curious to learn more about this, do check out the announcement in adapt to - https://adapt.to/2024/schedule/aem-65-and-java-17

 

Thanks

Narendra

 

1 reply

RajaShankar
Community Advisor
Community Advisor
December 3, 2024

Hi @fionas76543059 

Are you trying to compile with Cloud Manager or is this error happening in your local. If its cloud manager please check the  the maven compiler plugin to JDK 11 and include the maven tool chain plugin in the main pom.xml. 

Reference: https://experienceleague.adobe.com/en/docs/experience-manager-cloud-service/content/implementing/usi...

 

If its local can you try your local pom.xml for JDK 11 and also clear the M2 directory pertianing to aQute/bnd/osgi/Analyzer package.

Regards,

Rajashankar.R

Level 6
December 3, 2024

Thanks Rajashankar,  I use Cloud Manager for builds but my AEM is not in the cloud, it is AMS.

 

Just to clarify, when I am building locally, what should I have ? and where ? I have a Java 11 JAVA_HOME but I build in

an IDE that I set to SDK Java 11 for the project.

 

I have a  settings.xml file in my .m2 directory that points to Adobe repos but that is all. Should I add something else in there.?

 

Or should I have another "local" profile in my AEM project top pom.xml.?

 

Up to now, I just used whatever came out of the archetype 4 years ago and it never seemed to give any problems.....

December 4, 2024

Looking at the change log of maven-bundle-plugin - https://github.com/apache/felix-dev/blob/master/tools/maven-bundle-plugin/changelog.txt

 

The latest release 6.0.0 needs minimum java 17 so to resolve the issue you would need to update the maven-bundle-plugin to 5.1.9 or lower in the parent pom.xml. 

 

<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>

 

Also if you are curious to learn more about this, do check out the announcement in adapt to - https://adapt.to/2024/schedule/aem-65-and-java-17

 

Thanks

Narendra

 


Thanks for your reply @narendragandhi Changing the maven bundle pulgin version to 5.1.4 resolved my local build issue

<artifactId>maven-bundle-plugin</artifactId>
<version>5.1.4</version>