Maven ignoring provided scope
Asked Answered
B

2

6

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

Badderlocks answered 2/8, 2010 at 12:44 Comment(0)
S
4

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.

Sheehan answered 2/8, 2010 at 12:55 Comment(0)
A
2

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>
Ascus answered 2/8, 2010 at 14:8 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.