Maven: javaee-api vs jboss-javaee-6.0

david24365 picture david24365 · Mar 20, 2013 · Viewed 10.8k times · Source

I want a Java JEE6 project built with maven, and I want it standard

So, I put this in my pom.xml:

<dependency>
    <groupId>javax</groupId>
    <artifactId>javaee-api</artifactId>
    <version>6.0</version>
    <scope>provided</scope>
</dependency>

A project like this, it is supposed to run in every JEE6 container compatible (jboss, geronimo, glashfish, etc.)

Then, why this jboss dependency exists?

<dependency>
    <groupId>org.jboss.spec</groupId>
    <artifactId>jboss-javaee-6.0</artifactId>
    <version>3.0.2.Final</version>
    <scope>provided</scope>
 </dependency>

If I use it, am I tied to jboss so I can only use this server with this application?

Is it not preferable to always use the standard javaee-api?

Thank you!

Answer

omilke picture omilke · Mar 20, 2013

The standard api is crippled, i. e. method bodies are missing. This turns out when testing. I have once run into this pitfall and was not very happy with it.

Therefore it is advisiable to use another package as reference.

You can have a closer look on Adam Biens Blog

You can also make profiles for different deployment environments if you really need. However, essentially I agree, this is sadly not a very pleasant circumstance.

For having issues with testing, you can have a look at this thread.

Edit:
By the way, since now this might be interessting. This issue is gone for the javaee-(web-)api for Java EE 7 (source)