0

My project is divided into several modules, one of them is common which is supposed to be used to other modules.

In this module there are TestUtils which I want to be able to use from other modules.

My libraries does not seem to be added to the test-jar. How can I achieve this?

+ common
++ lib
++ src
+++ test
++++ java
++++ resources
+ pom.xml

My pom.xml contains some libraries which I include via system path, such as:

<dependency>
    <groupId>com.ibm</groupId>
    <artifactId>com.ibm.disthub2.dhbcore</artifactId>
    <version>5.3.07</version>
    <scope>system</scope>
    <systemPath>${basedir}/lib/dhbcore.jar</systemPath>
</dependency>
...
<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-jar-plugin</artifactId>
            <version>2.2</version>
            <executions>
                <execution>
                    <goals>
                        <goal>test-jar</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>
J2B
  • 1,703
  • 2
  • 16
  • 31

1 Answers1

0

Simple answer: Not possible. The test-jar is only intended for compiled classes under the folder src/test/java inclusive src/test/resources but not for supplemental jar files.

Apart from that using a system scope is in general a bad idea. Best is to put such jars into the company nexus and use it as a usual dependency. A lib folder in a Maven project is generally in indicator of build smells and should be avoided.

BTW: Why are you using such old versions of maven-jar-plugin (2008 version 2.2). Current version version 2.5 from this year.

khmarbaise
  • 92,914
  • 28
  • 189
  • 235