Dependence scope & ldquo; compile & rdquo; not included in the assembly

advertisements

I have the following dependency specified in my project's POM:

 <dependency>
  <groupId>org.jboss.client</groupId>
  <artifactId>jbossall-client</artifactId>
  <scope>compile</scope>
 </dependency>

My project itself has to be the child of another POM. And in that one, the following is defined:

<dependency>
   <groupId>org.jboss.client</groupId>
   <artifactId>jbossall-client</artifactId>
   <version>4.2.3.GA</version>
   <scope>provided</scope>
   <type>jar</type>
</dependency>

When I now assembly my program, it seems that the "provided" scope of the parent POM overrides the scope of my project, since the jbossall-client.jar is not included in my assembly. Although it seems illogical to me, maybe it's this feature taking effect here.

Do you know a way to include the dependency in my assembly without touching the parent POM?


Edit: Output of mvn dependency-tree (Updated!):

[dependency:tree]
com.myproject:myproject:jar:0.0.1-SNAPSHOT
+- com.myproject-commons:jar:1.0-SNAPSHOT:compile
|  +- commons-logging:commons-logging:jar:1.0.4:compile
|  +- log4j:log4j:jar:1.2.14:compile
|  +- sv.seucc:seucc-unicode:jar:1.0.1.5:compile
|  +- commons-lang:commons-lang:jar:2.2:compile
|  +- com.thoughtworks.xstream:xstream:jar:1.2.1:compile
|  \- xpp3:xpp3_min:jar:1.1.3.4.O:compile
+- com.myproject-interfaces2:jar:1.0-SNAPSHOT:compile
|  \- com.myproject-service-commons:jar:1.0-SNAPSHOT:compile
+- org.springframework:spring:jar:2.5.6:compile
+- commons-io:commons-io:jar:1.3.1:compile
+- com.myproject-modules:ejb:1.0-SNAPSHOT:compile
\- org.jboss.client:jbossall-client:jar:4.2.3.GA:compile


Edit 2: Here the dependency part of my assembly XML.

 <dependencySets>
  <dependencySet>
   <outputDirectory>lib</outputDirectory>
  </dependencySet>
 </dependencySets>


Edit 3: Here are the files in the lib folder of my obtained assembly.

commons-io-1.3.1.jar
commons-lang-2.2.jar
commons-logging-1.0.4.jar
log4j-1.2.14.jar
seucc-unicode-1.0.1.5.jar
spring-2.5.6.jar
xpp3_min-1.1.3.4.O.jar
xstream-1.2.1.jar
myproject-commons-1.0-SNAPSHOT.jar
myproject-modules-1.0-SNAPSHOT.jar
myproject-service-commons-1.0-SNAPSHOT.jar
myproject-interfaces2-1.0-SNAPSHOT.jar
myproject-0.0.1-SNAPSHOT.jar


Edit 4: For the answer to this question see the final comments of the correct answer.


Both dependencies don't have the same groupId so nothing get overridden here, they are treated as distinct artifacts. But I wonder how things work in your child pom (since the jbossall-client doesn't have any version). Do you have a dependencyManagement section?

Anyway, to "debug" this kind of problem, use mvn dependency:tree in your child project (and post the output if you need more help).


Update: The above was my answer to the initial question and does not reflect the current state of the question.

For the sake of clarity, the key of the final solution was to declare a <scope>compile</scope> (which defaults to runtime) in the dependencySet element of the assembly descriptor. See the comments for all details.

See also