Maven 2 assembly with dependencies: jar under scope "system" not included.

Posted by YuppieNetworking on Stack Overflow See other posts from Stack Overflow or by YuppieNetworking
Published on 2010-01-14T17:01:44Z Indexed on 2010/04/10 9:53 UTC
Read the original article Hit count: 351

Hello,

I am using maven-assembly plugin to create a jar of my application, including its dependencies as follows:

<assembly>
    <id>macosx</id>
    <formats>
       <format>tar.gz</format>
       <format>dir</format>
    </formats>
    <dependencySets>
        <dependencySet>
            <includes>
                <include>*:jar</include>
            </includes>
            <outputDirectory>lib</outputDirectory>
        </dependencySet>
    </dependencySets>
</assembly>

(I omitted some other stuff that is not related to the question)

So far this has worked fine because it creates a lib directory with all dependencies. However, I recently added a new dependency whose scope is system, and it does not copy it to the lib output directory. i must be missing something basic here, so I call for help.

The dependency that I just added is:

<dependency>
  <groupId>sourceforge.jchart2d</groupId>
  <artifactId>jchart2d</artifactId>
  <version>3.1.0</version>
  <scope>system</scope>
  <systemPath>${project.basedir}/external/jchart2d-3.1.0.jar</systemPath>
</dependency>

The only way I was able to include this dependency was by adding the following to the assembly element:

<files>
    <file>
        <source>external/jchart2d-3.1.0.jar</source>
        <outputDirectory>lib</outputDirectory>
    </file>
</files>

However, this forces me to change the pom and the assembly file whenever this jar is renamed, if ever. Also, it seems just wrong.

I have tried with <scope>runtime</scope> in the dependencySets and <include>sourceforge.jchart2d:jchart2d</include> with no luck.

So how do you include a system scoped jar to your assembly file in maven 2?

Thanks a lot

© Stack Overflow or respective owner

Related posts about maven-2

Related posts about maven-plugin