Run JUnit Test with maven dependencies from plugin

Hi Community,

I need to execute a JUnit Test of a project from my plugin.
My approach is this:

  • I search for the TestClass
  • Run it with JUnitCore

This works as long as the TestClass has no maven dependencies.

A solution is to add all the maven dependencies manually to the plugin project
but this will be a loss of portability.

Is there some way to resolve this problem without lack of portability?


1 comment
Comment actions Permalink

I found the solution by myself,

I use Runtime.getRuntime().exec(command) to execute a cmd command and run a Maven task.
With the Surefire plugin from Maven I can easily run the test.



Please sign in to leave a comment.