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:

Here is what I did to resolve it.
- 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