So for Java EE 5 there is the following Maven Dependency:
And for Java EE 6:
NOTE that the groupId has also changed, which also is not good. Since the new Maven Dependency will be harder to locate when browser a Maven Repository, but also harder for a programmer that wish to upgrade and only wish to increase the version field and nothing else.
So when using the javaee dependency you will typically end up with a following error:
So what is you option? There is two solution
- Keep the standard dependency and add the container specific dependency with test scope.
- Leave the path with compiling against the standard API and directly using the concrete container dependency.
The second one is also not very compelling since you want to develop generic code and the easiest way to uphold that, especially if you have less experienced programmers in your team, is not to have the concrete container classes at all in the class path when compiling your code.
Conclusion: I have giving up for a long time ago, trying to keep your code generic and in my next blog I will show you how to best use the JBoss EE dependency.