maven-scr-plugin fails with SCRDescriptorException "unable to scan files ... Class file format probably not supported by ASM ?"
Asked Answered
B

2

7

Using the following dependencies (amongst others, the bundle is supposed to be installed to AEM 6.1)

runtime is java8

  • maven-scr-plugin 1.15.0
  • org.apache.felix.scr.annotations: 1.9.8
  • org.apache.felix.scr.ds-annotations: 1.2.8

I get this exception

Caused by: org.apache.felix.scrplugin.SCRDescriptorException: Unable to scan class files: ... (Class file format probably not supported by ASM ?) at org.apache.felix.scrplugin.helper.ClassScanner.processClass(ClassScanner.java:219) at org.apache.felix.scrplugin.helper.ClassScanner.process(ClassScanner.java:161) at org.apache.felix.scrplugin.helper.ClassScanner.scanSources(ClassScanner.java:146) at org.apache.felix.scrplugin.SCRDescriptorGenerator.execute(SCRDescriptorGenerator.java:146) at org.apache.felix.scrplugin.mojo.SCRDescriptorMojo.execute(SCRDescriptorMojo.java:221) ... 22 more

Caused by: java.lang.IllegalArgumentException at org.objectweb.asm.ClassReader.(Unknown Source) at org.objectweb.asm.ClassReader.(Unknown Source) at org.objectweb.asm.ClassReader.(Unknown Source) at org.apache.felix.scrplugin.helper.ClassScanner.processClass(ClassScanner.java:201)

The class in question does not contain any osgi annotations at all, but is merely imported in some other @Component annotated classes.

Did anyone encounter this and found a solution?

Brockbrocken answered 20/10, 2015 at 14:0 Comment(0)
S
5

I ran into this issue today. This happens when you are running maven-scr-plugin with scanClasses=true option. Older versions of maven-scr-plugin cannot scan classfile generated by java8. you will have to either switch to a newer version of scr plugin (I upgraded to 1.22) or set you maven-compiler-plugin target config to 1.7

Supine answered 14/8, 2016 at 19:37 Comment(0)
S
2

I found out that my Felix SCR Annotation Processor plugin that I installed to my Intellij as a prerequisite to using the aem-ide-tooling-4-intellij from headwirecom is causing the issue. It was working for quite a while until today suddenly giving me an issue in running my unit tests (needless to say, there were no changes made in my java, mvn versions or in my IDE).

This forced me to update my java version, intellij version but didn't fix the issue. But disabled the SCR annotation plugin fixed it.

enter image description here

As you can see, this plugin is really old (2014). I hope they will release a newer version soon.

Swanhildas answered 25/9, 2017 at 8:42 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.