Issue with maven-bundle-plugin when adding dependencies to an AEM projects
Hi, we are having issues adding dependencies to a maven project that is based on the latest version of aem-project-archetype
To simplify the question I created a dummy project using the archetype.
After the project is created I run the
mvn clean install -U -PautoInstallPackage
maven command to install the package to my local AEM instance. So far so good.
Now for the purpose of the test I create a class that as a dependency on ehcache. I add the necessary dependency to pom.xml of the core module
<dependency> <groupId>net.sf.ehcache</groupId> <artifactId>ehcache</artifactId> <version>2.8.0</version> </dependency>
I run the mvn clean install and now the core bundle wont start and I get this message in the Imported Packages section of the bundle when looking at the felix console
net.sf.ehcache,version=[2.8,3) -- Cannot be resolved net.sf.ehcache.config,version=[2.8,3) -- Cannot be resolved
After looking at the felix maven-bundle-plugin documentation http://felix.apache.org/documentation/subprojects/apache-felix-maven-bundle-plugin-bnd.html
I see that I need to add the dependency through either <Embed-Dependency> or <Private-Package>. So trying this
<plugin> <groupId>org.apache.felix</groupId> <artifactId>maven-bundle-plugin</artifactId> <extensions>true</extensions> <configuration> <instructions> <Embed-Dependency> ehcache;inline=true </Embed-Dependency> <Sling-Model-Packages> com.mvndt.core </Sling-Model-Packages> </instructions> </configuration> </plugin>
And running
mvn clean install -U -PautoInstallPackage
The bundle still won't start, but now I get multiple missing dependencies under the imported package section in the felix console
org.hibernate -- Cannot be resolved org.hibernate.cache -- Cannot be resolved org.hibernate.cache.access -- Cannot be resolved org.hibernate.cfg -- Cannot be resolved org.hibernate.impl -- Cannot be resolved org.hibernate.stat -- Cannot be resolved org.hibernate.transaction -- Cannot be resolved org.quartz -- Cannot be resolved org.quartz.impl -- Cannot be resolved org.quartz.impl.jdbcjobstore -- Cannot be resolved org.quartz.impl.matchers -- Cannot be resolved org.quartz.simpl -- Cannot be resolved org.terracotta.quartz -- Cannot be resolved org.terracotta.toolkit -- Cannot be resolved org.terracotta.toolkit.atomic -- Cannot be resolved org.terracotta.toolkit.builder -- Cannot be resolved org.terracotta.toolkit.cache -- Cannot be resolved org.terracotta.toolkit.cluster -- Cannot be resolved org.terracotta.toolkit.collections -- Cannot be resolved ...
It looks like my dependency is now conflicting with other dependency in the bundle.
Does anyone have any idea what I'm doing wrong here?
I dont get this problem with all dependencies but on some cases like with ehcache I do
Any help is more than welcome.
Thanks
-Alain

