7

I am trying to run 2 maven goals in one maven command like:

mvn release:prepare release:perform -Darguments='-Dmaven.test.skip=true'

but, I would like the first goal to skip tests and the second one not to skip tests.

It has to be in one line command.

Is there a way to do it other than executing them in 2 separate commands?

Eric
  • 61
  • 1
  • 1
  • 2
  • Could you post your `POM.xml` file content, maybe a minimal content – dvhh Apr 01 '15 at 04:42
  • Have you looked at profiles? This question may help, http://stackoverflow.com/questions/17117589/how-can-i-skip-tests-in-maven-install-goal-while-running-them-in-maven-test-goa – Adisesha Apr 01 '15 at 05:06

2 Answers2

4

You can use the following:

mvn -Dmaven.test.skip=true release:prepare release:perform

Within release-plugin the arguments are passed via -Darguments='....' to the sub process which is started by release:perform. The other arguments are passed to the process which is started by release:prepare.

khmarbaise
  • 92,914
  • 28
  • 189
  • 235
  • 1
    This doesn't work for me. -Dmaven.test.skip=true does not skip any tests from any goals – Eric Apr 06 '15 at 23:42
1

I have spent hours on this.

My working release command is:

-Darguments='-DskipTests=true' -DskipTests release:prepare release:perform

The problem actually was in my release plugin:

<plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-release-plugin</artifactId>
            <configuration>
                <arguments>${release.arguments}</arguments>

The "arguments" parameter of the release plugin was overriding the -Darguments that I pass to the release:prepare (in order to be passed to release:perform by release:prepare).

Remy
  • 502
  • 6
  • 19