You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Jeff <pr...@gmail.com> on 2015/01/24 01:24:35 UTC

How do I target tests in submodule when building parent project?

I have a multi-module test project building w/ Maven v3.2.1.  There are a
couple of common modules that don't have any tests as they are just support
libraries but needed for the test modules.

The rest of the modules are specific to testing a certain functional
areas.  I need to check out and build the whole multi-module project, but I
only want to run a subset of tests from one specific submodule.

I've tried:
   mvn clean test -U -D test=module2/**/Test_Functional* -P wp-dev -P wp-dev

but it fails trying to run tests in module1.  How do I configure the
command so that it will not run tests for any module except the one I
specify?  I can't seem to find this specific scenario in my searches.

FWIW, I'm using maven-surefire + TestNG.  I can't split it into two
commands (build w/ no tests, then run tests) because I'm having issues in
Jenkins getting the maven build step and the "Invoke top-level Maven
targets" pre-build step to use same maven repository (that's a different
discussion).

Thanks!!

Re: How do I target tests in submodule when building parent project?

Posted by Barrie Treloar <ba...@gmail.com>.
On 24 January 2015 at 10:54, Jeff <pr...@gmail.com> wrote:
> The rest of the modules are specific to testing a certain functional
> areas.  I need to check out and build the whole multi-module project, but I
> only want to run a subset of tests from one specific submodule.

Why?

You should be doing all or nothing.

If they are unit tests they should run fast and therefore have
neglible impact on your build times.

If they are integration tests then they should be in their own module.
If you then exclude the integration test module from the parent it
will not run the integration tests and not impact developer build
times. You place the modules in a profile and have Jenkins enable it
to run the tests. If the developers also want to run them they can
enable to profile on the command line.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org