Maven JavaEE 6 dependency for both Tomcat and JBoss

Which JavaEE 6 maven dependency should be included in a web app to be deployed on Tomcat and JBoss? Both?

Tomcat:

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

JBoss:

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

Upvotes: 1

Views: 3000

Answers (1)

Mikko Maunu
Mikko Maunu

Reputation: 42084

Dependency javax/javaee-api/6.0 as provided fine for Java EE 6 implementations.

Because Tomcat is not one of those (assuming that you do not refer to TomEE), it is quite misleading to use it with Tomcat. Tomcat as a servlet container does implement only subset of of features of Java EE 6). In practice it works as long as such a functionality that is not provided by tomcat is not used.

Be aware that you will run to the problems if you use any classes from this dependency with unit tests for example. These classes are usable only compile time.

Upvotes: 5

Related Questions