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

If you run into a javax.inject error, here is a quick and easy way to resolve it.

 

I created a new AEM Maven project and upon deployment (in the OSGi bundles), I found that AEM was unable to resolve the “javax.inject” package as outlined in the screenshot below:

 

javax.inject error in AEM when the sling project bundle cant be activated
javax.inject error in AEM when the sling project bundle cant be activated

Here is what I did to resolve it.

  1. Updated the project POM file to add the required dependency

            <dependency>

                   <groupId>javax.inject</groupId>

                  <artifactId>javax.inject</artifactId>

                  <version>1</version>

                  <scope>provided</scope>

            </dependency>

Note:

  • For AEM 6.2 onwards the <version> value needs to be 1
  • For AEM 6.0-6.1, use <version> value of 0.

Happy coding!

Be First to Comment

Leave a Reply

Your email address will not be published.