Use the maven-invoker component (which is also used by the
maven-invoker-plugin so you can see examples of how to use it in that code
base)

On 3 August 2010 08:24, jstrachan <[email protected]> wrote:

>
> I've seen the "how do I call a Mojo from a Mojo" question asked a number of
> times before on the list and the typical answer seems to be something like
> "you don't", "you're doing it wrong" or "create your own lifecycle" etc. In
> my case though I really do want to :)
>
> Here's the use case; I'm trying to do this
> http://github.com/davidB/maven-scala-plugin/issues#issue/35
>
> basically SBT has an incremental test mode which detects if you change any
> source files then it recompiles whatever is required and if the build
> succeeds it can automatically run all the tests, test which match a
> particular pattern or run just tests that failed last time.
>
> This is an amazingly useful feature; I find myself using it a lot.
>
> The maven-scala-plugin already has a good incremental test goal (mvn
> scala:cc) which watches source files and recompiles whatever needs to be
> recompiled. I've added a hook so on a successful build we can do something
> like run the tests.
>
> However what I want to do is run the tests using the current pom.xml test
> configuration (so folks don't have to configure surefire twice). So really
> I
> just want maven to run "surefire:test" from inside the continuous compile
> mojo - on demand whenever a continuous build is completed - rather than
> explicitly depend on surefire and configure its mojo manually myself etc.
>
> Whats the current best practice way to try do this from a Mojo? Using Maven
> Embedder?
>
> Any help greatly appreciated!
> --
> View this message in context:
> http://maven.40175.n5.nabble.com/invoking-surefire-test-from-an-incremental-compile-Mojo-tp2262642p2262642.html
> Sent from the Maven - Users mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>

Reply via email to