Apache Felix SCR Plugin Compatibility Chart
One of the issues I’ve run into during the past when setting up AEM / CQ5 projects is incompatibility between the various versions of theApache Felix SCR Annotations and the Apache Felix Maven SCR Plugin.
Usually, when this occurs, you will see an error like this when building the project:
[ERROR] Failed to execute goal org.apache.felix:maven-scr-plugin:1.20.0:scr (generate-scr-descriptor) on project felix-annotation-test-bundle: Please use org.apache.felix:org.apache.felix.scr.annotations version 1.9.0 or newer. -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.felix:maven-scr-plugin:1.20.0:scr (generate-scr-descriptor) on project felix-annotation-test-bundle: Please use org.apache.felix:org.apache.felix.scr.annotations version 1.9.0 or newer.
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:120)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:355)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:155)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:584)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:216)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:160)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.MojoFailureException: Please use org.apache.felix:org.apache.felix.scr.annotations version 1.9.0 or newer.
at org.apache.felix.scrplugin.mojo.SCRDescriptorMojo.assertMinScrAnnotationArtifactVersion(SCRDescriptorMojo.java:388)
at org.apache.felix.scrplugin.mojo.SCRDescriptorMojo.getClassPath(SCRDescriptorMojo.java:348)
at org.apache.felix.scrplugin.mojo.SCRDescriptorMojo.execute(SCRDescriptorMojo.java:206)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:132)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
... 19 more
[ERROR]
or
[ERROR] Failed to execute goal org.apache.felix:maven-scr-plugin:1.4.0:scr (generate-scr-descriptor) on project felix-annotation-test-bundle: Execution generate-scr-descriptor of goal org.apache.felix:maven-scr-plugin:1.4.0:scr failed: 0 -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.felix:maven-scr-plugin:1.4.0:scr (generate-scr-descriptor) on project felix-annotation-test-bundle: Execution generate-scr-descriptor of goal org.apache.felix:maven-scr-plugin:1.4.0:scr failed: 0
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:224)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:120)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:355)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:155)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:584)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:216)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:160)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.PluginExecutionException: Execution generate-scr-descriptor of goal org.apache.felix:maven-scr-plugin:1.4.0:scr failed: 0
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:143)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
... 19 more
Caused by: java.lang.ArrayIndexOutOfBoundsException: 0
at org.apache.felix.scrplugin.tags.JavaClassDescriptorManager.getSourceDescriptions(JavaClassDescriptorManager.java:393)
at org.apache.felix.scrplugin.SCRDescriptorMojo.execute(SCRDescriptorMojo.java:167)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:132)
... 20 more
[ERROR]
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginExecutionException
After several frustrating instances of manually changing the Apache Felix SCR Annotations and Apache Felix Maven SCR Plugin versions until I got them to work, I decided to systematically test which versions of the two libraries are compatible.
To do this, I created a project with a simple OSGi Service and Sling Servlet created with placeholders for the versions of Apache Felix SCR Annotations and Apache Felix Maven SCR Plugin. I then iterated through the versions and tested to ensure that the project built, was deployed to Apache Felix and that the servlet responded correctly.
If you’d like to check out the method or project, please feel free to check it out from GitHub.
Compatibility
Below you can find a table of the compatible versions of the Apache Felix SCR Annotations and Apache Felix Maven SCR Plugin:
maven-scr-plugin Versions | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
org.apache.felix.scr.annotations Versions | 1.21.0 | 1.20.0 | 1.19.0 | 1.17.0 | 1.16.0 | 1.15.0 | 1.14.0 | 1.13.0 | 1.12.0 | 1.11.0 | 1.10.0 | 1.9.0 | 1.8.0 | 1.7.4 | 1.7.2 | 1.7.0 | 1.6.0 | 1.4.4 | 1.4.2 | 1.4.0 |
1.9.12 | T | T | T | T | T | T | T | T | T | T | F | T | T | F | F | F | F | T | T | F |
1.9.10 | T | T | T | T | T | T | T | T | T | T | F | T | T | F | F | F | F | T | T | F |
1.9.8 | T | T | T | T | T | T | F | T | T | T | F | T | T | F | F | F | F | T | T | F |
1.9.6 | T | T | T | T | T | T | T | T | T | T | F | T | T | F | F | F | F | T | T | F |
1.9.4 | T | T | T | T | T | T | T | T | T | T | F | T | T | F | F | F | F | T | T | F |
1.9.2 | T | T | T | T | T | T | T | T | T | T | F | T | T | F | F | F | F | T | T | F |
1.9.0 | T | F | T | T | T | T | T | T | T | T | F | T | T | F | F | F | F | T | T | F |
1.8.0 | F | F | F | F | F | F | F | F | F | F | F | T | T | F | F | F | F | T | T | F |
1.7.0 | F | F | F | F | F | F | F | F | F | F | F | T | T | F | F | F | F | T | T | F |
1.6.0 | F | F | F | F | F | F | F | F | F | F | F | F | F | T | T | F | F | T | T | F |
1.5.0 | F | F | F | F | F | F | F | F | F | F | F | F | F | F | F | F | F | T | T | F |
1.4.0 | F | F | F | F | F | F | F | F | F | F | F | F | F | F | F | T | T | T | T | F |
1.3.0 | F | F | F | F | F | F | F | F | F | F | F | F | F | F | F | F | F | T | T | F |
1.2.0 | F | F | F | F | F | F | F | F | F | F | F | F | F | F | F | F | F | T | T | F |
1.0.0 | F | F | F | F | F | F | F | F | F | F | F | F | F | F | F | F | F | T | T | F |
0.9.0 | F | F | F | F | F | F | F | F | F | F | F | F | F | F | F | F | F | T | T | F |