I'm trying to use a test-jar dependency in another maven module during testing. So just like in this question (Maven test dependency in multi module project) and in the maven guides, I placed a test-jar goal in module A, and put a dependency on it in module B where I want to use some classes from A in my testing. Eclipse recognizes all my classes properly, and when I run a clean install from my project root, then run mvn dependency:tree
in module B, I see module A.
However, when I run a mvn clean install
, maven complains that
... package 'my.package.in.module.A' does not exist
Structure of my project is
reactor
--module A
--module B
Pom A:
...
<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>
...
Pom B:
...
<dependency>
<groupId>com.company.moduleA</groupId>
<artifactId>module-A</artifactId>
<version>moduleA-version</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>
I left out the version/artifact/etc for privacy, but they match up properly.
Am I missing something?
EDIT: This is maybe not the right solution to this question in particular, but I just removed the <type>test-jar</type>
and got it working without using that.