Reputation: 11055
I have one project A which has some test resources. POM file Of Project B has dependency of Project A.
How Can I use test resources from Project A in test cases of Project B.
Upvotes: 1
Views: 843
Reputation: 15308
In Maven you have to depend on some artifact. Unless tests are packaged into a jar file you can't depend on them. So you either need to move the resources into production code or you need to create jar with tests:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.0.2</version>
<executions>
<execution>
<goals>
<goal>test-jar</goal>
</goals>
</execution>
</executions>
</plugin>
Then you can depend on it:
<dependency>
<groupId>groupId</groupId>
<artifactId>artifactId</artifactId>
<type>test-jar</type>
<version>version</version>
<scope>test</scope>
</dependency>
Upvotes: 3