Wrapped maven bundle of type test-jar is not loaded from local repository

Description

I have created general test data creation functionality for some business objects inside the src/test/java folder of my business object bundle project and told the maven-jar-plugin to create a test-jar for this project. I installed this test jar in my local repository. Now I can use this test jar (as maven dependency with the addition <type>test-jar</type>) for the test data creation inside other projects (only inside the test classes). As long as I do simple JUnit module tests this works like a charm. For an integration test I created an extra project. I added the test jar there inside the pom as well. The eclipse compiler knows the test data creation classes and I can use them inside my pax exam integration test. When I run the test I get the following java.lang.ClassNotFoundException:

I understand this behavior. The test container does not know this class, there is no bundle exporting it. To add my test data creation classes I tried to add them as bundle but this fails. I added the following line:

In my logs I can see the following:

Why doesn't it try to resolve this from my local repo? I also get another exception at the end:

The TechPartnerPersistenceManager is the class I would like to test. If I copy the test data creation functionality inside my test class everything works as expected. I do not think that there is a failure inside the test itself. I am using the following dependencies to run my pax exam tests:

I use the following configuration:

Environment

Karaf version 3.0.3, Windows 7, Java 7, Eclipse Luna 4.4.1

Activity

Show:
Achim Nierbeck
May 21, 2015, 9:45 PM

also take a look at the working-test.jar

Achim Nierbeck
May 21, 2015, 9:45 PM

This is not an issue of pax-url or pax-exam

Thomas Fuhrmann
May 26, 2015, 2:50 PM

Thanks for this correction! It works ... and therefore saves a lot of time and trouble ... even though I do not understand why the original example does not work. It contains a JUnit test which needs the same classes of the "test-jar" like the contained Pax Exam test does. The JUnit test uses this dependency in the pom to work:

This is the exact match to:

I do not understand why it is not similar. The method "maven" suggests original maven syntax ... but anyway, it works. Many thanks again!

Achim Nierbeck
May 26, 2015, 2:59 PM

well a type test-jar isn't produced it's a jar that is produced by calling the maven-jar-plugin.
And to be more clear, by adding the test-jar goal you just make sure you have another jar added to the produced artifacts, it contains the same groupId and artifactId, to make it more unique the tests classifier is added. That's all the magic

Thomas Fuhrmann
May 26, 2015, 3:15 PM

seems to be a special maven trick or internal mapping

seems to be similar to

Assignee

Harald Wellmann

Reporter

Thomas Fuhrmann

Labels

Components

Affects versions

Priority

Minor
Configure