Monday, 24 October 2016

How to FIX : javax.inject,version=[0.0,1) -- Cannot be resolved

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

The Scene:

So on a Saturday afernoon I was working on some AEM backend services and I came
across this issue which I have never faced before. It was something to do with the
javax.inject package that is used when we are using the @Inject annotations
in our classes.

The Problem:

So like a normal developer bloke I Googled around a bit and came to know that this was some
kind of dependency issue. But I was surprised that even though we can find the dependency using
depfinder --> http://localhost:4502/system/console/depfinder it was not resolved.

Finally the SOLUTION:

So I tried adding the javax.inject dependencies to my project POM file (i was using Maven)
and it WORKED!!!


The Cause:

Though I am not quite sure about the cause for this issue but I believe
this is a problem persistent in AEM version 6.2 (AEM 6.2 javax.inject dependency problem)
as I have executed the same code in AEM 6.1 without issues.

Please let me know in the comments below if you have the reason or additional info.