AEM 6.5.2 compilation errors with JDK 11

saik8550271

18-10-2019

Hi -

We are getting Code compilation errors as Failed to execute goal org.apache.felix:maven-scr-plugin:1.25.0:scr (generate-scr-scrdescriptor)

when we compile our code with JDK 11 for AEM 6.5.2 upgrade.

If anybody faced same problem and resolved it or have any idea of resolution, would be helpful.

[ERROR] Failed to execute goal org.apache.felix:maven-scr-plugin:1.25.0:scr (generate-scr-scrdescriptor) on project <????>

(Class file format probably not supported by ASM ?): Ille

galArgumentException -> [Help 1]

Accepted Solutions (1)

Accepted Solutions (1)

Answers (2)

Answers (2)

sunjot16

Employee

25-10-2019

This issue seems to be coming from the maven-scr-plugin. By moving to Java 11, the class files that you create will be compiled to Java 11 byte code. The maven-scr-plugin then has to scan this byte code to find the annotations that are applied to it. You may need to find the maven-scr-plugin that supports Java 11.

I found a few relevant links that contain the hotfixes/workarounds and could be helpful:

* https://github.com/headwirecom/aem-ide-tooling-4-intellij/issues/20

* https://stackoverflow.com/questions/53086179/maven-src-plugin-java-11-unable-to-scan-class-files

* https://wso2.org/jira/browse/CARBON-15369

I also found out that the latest version of maven-scr-plugin is 1.26.2. It could be possible that this latest version of the plugin has support for Java 11.

Maven Repository: org.apache.felix » maven-scr-plugin » 1.26.2

sunjot16

Employee

18-10-2019

Could you please verify whether the source and the target compilers are using jdk11 or auto setting, in your IDE and also that the machine shows the latest version of Java (11) as installed by checking the java version on it?

In AEM, you can check & set the compilers by following the below steps:

In http://<host>:<port>/system/console/configMgr, open Apache Sling Java Script Handler, and set Source & Target VMs to auto or to some jdk 11 version.

Hope it helps.