1
votes

I'm trying to build a new project using mvn aem-project-archetype (https://github.com/Adobe-Marketing-Cloud/aem-project-archetype) and on deploy the core bundle shows status as "Installed" but cannot be Active showing the error

javax.inject, version=[0.0,1) -- Cannot be resolved

enter image description here

I tried to add the dependencies as suggested here (https://github.com/Adobe-Marketing-Cloud/aem-project-archetype/issues/59)

 <dependency>
    <groupId>org.apache.geronimo.specs</groupId>
    <artifactId>geronimo-atinject_1.0_spec</artifactId>
    <version>1.0</version>
    <scope>provided</scope>
</dependency>
<dependency>
    <groupId>javax.inject</groupId>
    <artifactId>javax.inject</artifactId>
    <version>1</version>
</dependency>

and also tried all solutions as listed here (http://help-forums.adobe.com/content/adobeforums/en/experience-manager-forum/adobe-experience-manager.topic.html/forum__fikl-ive_just_updatedfro.html) but they did not resolve.

Appreciate any help here.

3
Have you written <Embed-Dependency><Embed-Dependency>*;scope=compile|runtime;inline=false</Embed-Dependency></Embed-Dependency> in maven-bundle-plugin instrutionsRavi Kumar
Thanks. Tried it, but the same issue. The below did not Activate the bundle: <plugin> <groupId>org.apache.felix</groupId> <artifactId>maven-bundle-plugin</artifactId> <version>2.5.3</version> <inherited>true</inherited> <configuration> <instructions> <Embed-Dependency>*;scope=compile|runtime;inline=false</Embed-Dependency> </instructions> </configuration> </plugin>Suren Konathala

3 Answers

2
votes

Add Import-Package tag for "javax.inject" with version "0.0.0,*" under "org.apache.felix" plugin tag like below:

<plugin>
    <groupId>org.apache.felix</groupId>
    <artifactId>maven-bundle-plugin</artifactId>
    <extensions>true</extensions>
    <configuration>
        <instructions>
          <!-- <Embed-Dependency>
                artifactId1,artifactId2;inline=true
          </Embed-Dependency> -->

          <!-- Import any version of javax.inject, to allow running on multiple versions of AEM -->
          <Import-Package>javax.inject;version=0.0.0,*</Import-Package>

          <Sling-Model-Packages>com.xyz.sample_test_impl.core</Sling-Model-Packages>
        </instructions>
     </configuration>
</plugin>
0
votes

After some research here's some solutions for the above:

  1. Comment "@Inject" in HelloWorldModel.java . This may not be ideal, but if you are not planning on using Sling Models, then this will work.

    @Model(adaptables=Resource.class)
    public class HelloWorldModel {
    
    //@Inject
    private SlingSettingsService settings;
    
    //@Inject @Named("sling:resourceType") @Default(values="No resourceType")
    protected String resourceType;
    
  2. Use ACS's Lazybones AEM Template instead of Archetype 10 if you will be using AEM 6.1 or higher. This is the recommended template to use with AEM whihc is more sophisticated and up-to-date.

0
votes

Try to sync your dependencies list with the following official sample project. In fact, it helped for me just after adding

        <dependency>
            <groupId>javax.inject</groupId>
            <artifactId>javax.inject</artifactId>
            <version>1</version>
            <scope>provided</scope>
        </dependency>

to general pom.xml and

        <dependency>
            <groupId>javax.inject</groupId>
            <artifactId>javax.inject</artifactId>
        </dependency>

to its child ../core/pom.xml