views:

16

answers:

2

I have a EAR with a number of EJB dependencies. 2 of these have a provided scope dependency to the glassfish-embedded-all jar. However when I do a mvn install on my local machine or when the application is build through maven on hudson the ear always contains the glassfish-embedded-all jar.

e.g. DataAccess-ejb with provided dependency

<dependency>
     <groupId>org.glassfish.extras</groupId>
     <artifactId>glassfish-embedded-all</artifactId>
     <version>3.0</version>
     <scope>provided</scope>
</dependency>

Application-ear with ejb dependency

<dependency>
     <groupId>com.xxx.yyy</groupId>
     <artifactId>DataAccess-ejb</artifactId>
     <version>1.0-SNAPSHOT</version>
     <type>ejb</type>
</dependency>

Any ideas what I am doing wrong or possible suggestions?

Cheers,

James

+1  A: 

Try using mvn dependency:tree in order to analyze what artifact is including the glassfish-embedded-all.jar, chances are that you're overlooking something. Maven won't include an artifact that is not declared as as direct dependency and/or inherited through transitive dependency.

You can also issue and mvn dependency:analyze-only command to further clean up those dependencies that you don't really need.

StudiousJoseph
+2  A: 

Dependencies with a provided scope are not transitive so you're not getting it transitively, there must be something else. Run mvn dependency:tree from the ear module.

But actually, I really wonder why you're using a provided scope, I think a test scope might be more appropriate. And by the way, I suggest using GF 3.0.1:

<dependency>
  <groupId>org.glassfish.extras</groupId>
  <artifactId>glassfish-embedded-all</artifactId>
  <version>3.0.1</version>
  <scope>test</scope>
</dependency>
Pascal Thivent