views:

21

answers:

0

Hi folks,

I’m new to maven and my first task is writing a Mojo. We are running a integration test tool which loads some classes of the build output and runs some tests on them. I managed to write a maven pom for the test library, so I can include it wherever I want. My Problem is now to write a plugin which runs the tests automatically. The plugin depends on the library and contains a simple Mojo which starts the test process. I’m able to integrate the plugin into the build-process and to execute it in the integration-test phase, but when it gets executed, the output of my project is not in the classpath.

If I got this right, this is because the plugin does not depend on the project which uses the plugin and so the automatically generated classpath does not contain target/classes. Google knows many similar problems, but most of them are ant problems. Or I just don’t see the point - I don’t know. According to [1], I have to write my own classloader. Doing this, I was able to load the classes in the Mojo, but my library was still unable to find them.

So I think my real question is: "How do I get the project output into the class path of a test-plugin" Perhaps I got the concept of maven wrong? Do you have any pointers for me?

Many thanks, Jochen

[1] http://maven.apache.org/guides/mini/guide-maven-classloading.html