There's a standard maven way to disable the running of the unit tests. There are many goals which depend on this (site, jar, jar:deploy, dist and so forth). Creating aliases for every goal in Maven to exclude running of the unit tests doesn't really scale & makes things messier.

You're most welcome to hack your local copy of maven.xml to add whatever aliases you wish for things though. Or write a shell script for

maven jar -Dmaven.test.skip=true

and call it build-no-test or whatever you wish.

I don't see a need to change Maven or our Maven build process for this.


On Friday, August 29, 2003, at 09:24 am, Alex Blewitt wrote:

On Friday, Aug 29, 2003, at 08:59 Europe/London, James Strachan wrote:

No - unit tests are part of the build process and they should stay there.

Either that, or a not-build-but-everything-but-tests target should be created; I've not managed to find one in Maven so far (at least, one that does everything bar test).

I don't follow.

// to compile just the code & tests
maven java:compile test:compile

You can disable the running of the unit tests if you wish via the maven.test.skip=true property which can be specified in your build.properties or on the command line. What more do you need?

In my experience in using Java projects (using ant, rather than maven; the latter is a bit new to me) there were separate 'build' and 'test' targets. I think there is benefit in a build-and-test target, but the problem is that a build is not just java:compile; dependent Jars need to be created, resources copied to appropriate locations and so forth.


IMNSO the targets would be beneficial if ordered:

build-and-test
+-- build-without-test
    +-- java:compile, jar:jar etc. as is at the moment
+-- test
    +-- test:compile
    +-- test:test (or whatever the appropriate target is)

That way, a developer could run build-and-test or build-without-test as desired.

No - unit tests are part of the build process and they should stay there.

Certainly I believe very strongly that there should be tests, and the ability to run them out-of-the-box. You could use whatever names you wanted for the above targets, so 'build-and-test == build' and 'build-without-tests' could have a different name.


But having this as a separate target, as opposed to having to run with setting maven properties (on command line, or in properties file) would be a nicer way of doing it. You could even set up the target 'build-without-test' to set the maven.test.skip and then call the original build process ...

Alex.



James ------- http://radio.weblogs.com/0112098/



Reply via email to