Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

cannot build maven project with 6.1 uber-jar

Avatar

Level 2

We are upgrading a dev environment from 5.6.1 to 6.1 and attempting to use the uber-jar (obfuscated) to build the maven project.  I've updated versions on all other dependencies and plugins.  I've tried deleting everything under .m2.  I've tried what is described here: https://github.com/Adobe-Consulting-Services/lazybones-aem-templates/issues/8.  I've looked at all of the forum posts related to the uber-jar and have tried adding in more dependencies but still this error exists.  Does anyone have any ideas?

[ERROR] Failed to execute goal org.apache.felix:maven-scr-plugin:1.21.0:scr (generate-scr-descriptor) on project ubcms-services: Execution generate-scr-descriptor of goal org.apache.felix:maven-scr-plugin:1.21.0:scr failed: An API incompatibility was encountered while executing org.apache.felix:maven-scr-plugin:1.21.0:scr: java.lang.VerifyError: (class: com/day/cq/wcm/commons/AbstractImageServlet, method: <init> signature: ()V) Constructor must call super() or this()
[ERROR] -----------------------------------------------------
[ERROR] realm =    plugin>org.apache.felix:maven-scr-plugin:1.21.0
[ERROR] strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
[ERROR] urls[0] = file:/Users/ms389/.m2/repository/org/apache/felix/maven-scr-plugin/1.21.0/maven-scr-plugin-1.21.0.jar
[ERROR] urls[1] = file:/Users/ms389/.m2/repository/org/apache/maven/maven-archiver/2.2/maven-archiver-2.2.jar
[ERROR] urls[2] = file:/Users/ms389/.m2/repository/junit/junit/3.8.1/junit-3.8.1.jar
[ERROR] urls[3] = file:/Users/ms389/.m2/repository/org/codehaus/plexus/plexus-archiver/1.0-alpha-7/plexus-archiver-1.0-alpha-7.jar
[ERROR] urls[4] = file:/Users/ms389/.m2/repository/org/apache/felix/org.apache.felix.scr.generator/1.13.0/org.apache.felix.scr.generator-1.13.0.jar
[ERROR] urls[5] = file:/Users/ms389/.m2/repository/org/ow2/asm/asm-all/5.0.2/asm-all-5.0.2.jar
[ERROR] urls[6] = file:/Users/ms389/.m2/repository/org/osgi/org.osgi.core/4.2.0/org.osgi.core-4.2.0.jar
[ERROR] urls[7] = file:/Users/ms389/.m2/repository/org/osgi/org.osgi.compendium/4.2.0/org.osgi.compendium-4.2.0.jar
[ERROR] urls[8] = file:/Users/ms389/.m2/repository/org/sonatype/plexus/plexus-build-api/0.0.7/plexus-build-api-0.0.7.jar
[ERROR] urls[9] = file:/Users/ms389/.m2/repository/org/codehaus/plexus/plexus-utils/1.5.8/plexus-utils-1.5.8.jar
[ERROR] Number of foreign imports: 1
[ERROR] import: Entry[import  from realm ClassRealm[project>edu.buffalo.ubcms:ubcms-services:6.1.0-SNAPSHOT, parent: ClassRealm[maven.api, parent: null]]]

1 Accepted Solution

Avatar

Correct answer by
Level 10

Also - do not forget - you can also use AEM dependency Finder (as opposed to Urber JAR):

http://localhost:4502/system/console/depfinder

I like that tool - it informs you exactly what POM dependency you need. 

http://labs.6dglobal.com/blog/2012-05-04/new-cq-55-dependency-finder/

View solution in original post

8 Replies

Avatar

Level 10

Try building the GitHub project that is discussed here and uses: 

<dependency>
    <groupId>com.adobe.aem</groupId>
    <artifactId>uber-jar</artifactId>
    <version>6.1.0</version>
    <classifier>obfuscated-apis</classifier>
    <scope>provided</scope>
</dependency>

https://docs.adobe.com/docs/en/aem/6-1/develop/dev-tools/ht-projects-maven.html

https://github.com/scottm2020/aem-uberjar-demo

I just cloned this Github repository and it built successfully:

Here is the Maven result: 

Avatar

Level 2

Peter,  I did read through this and added any dependencies and repositories, plugins, etc.  Still I get the same error.  I'm beginning to think I need the unobfuscated jar.  I've put in a request for it.

Avatar

Level 2

smacdonald2008,

The demo project does build for me but my own project still does not.  As I said to Peter I'm beginning to think I need the unobfuscated jar.

Our servlets extend sling servlets  and the extended class uses SCR annotations but since they were not day or cq/aem classes I didn't think I'd need the unobfuscated jar.

So, maybe we do need it.

Avatar

Level 10

"Our servlets extend sling servlets  and the extended class uses SCR annotations"

You still need to include POM dependencies for non AEM classes - such as servlets:

<dependency>
    <groupId>javax.servlet</groupId>
    <artifactId>servlet-api</artifactId>
    <version>2.5</version>
</dependency>

The Urber JAR is for AEM Java classes - such as com.day.cq.mailer.MessageGateway

These are the JAVA APIS that should be covered in the Urber JAR:

https://docs.adobe.com/docs/en/cq/5-6-1/javadoc/index.html

Avatar

Level 2

Yes, we are including the dependencies for non-AEM libraries like the servlets.  I have included the ones mentioned here:  http://www.wemblog.com/2014/07/how-to-include-all-cq-dependencies-in.html as well as any from the demo project that I had not already included.

Avatar

Correct answer by
Level 10

Also - do not forget - you can also use AEM dependency Finder (as opposed to Urber JAR):

http://localhost:4502/system/console/depfinder

I like that tool - it informs you exactly what POM dependency you need. 

http://labs.6dglobal.com/blog/2012-05-04/new-cq-55-dependency-finder/

Avatar

Level 2

Well, it looks like we are extending the AbstractImageServlet class and using annotations to boot.  Not sure why my initial search for this class in our code base didn't find it but it did find it just now.  So, I'm assuming based on this that we really do need the unobfuscated jar and I have requested it.  After getting it and putting it to use I'll post back if that does resolve my problem.