1

When I specify the same Maven CLI option multiple times with different values, which value is picked up by Maven?

For example, let's say I have

mvn -T 1 -T 4 -Dmaven.test.skip=true -Dmaven.test.skip=false install

Will the Maven build be executed with 1 or with 4 threads? Will the tests be executed or no?

Is there a guaranteed mechanism in Maven for picking up CLI option values?

Harold L. Brown
  • 8,423
  • 11
  • 57
  • 109
  • 1
    Whatever you find out here, if it is not explicitly documented it is subject to change and usually when it is most inconvenient to you. Don’t rely on it. – Thorbjørn Ravn Andersen Nov 11 '22 at 09:23
  • 1
    ..for maven (apache CLI) arguments (https://github.com/apache/maven/blob/master/maven-embedder/src/main/java/org/apache/maven/cli/CLIManager.java), i'd assume 1st wins, for "-D" properties, seems last wins(https://stackoverflow.com/q/10956676/592355)...so, my guess: `T=1` and `skip.test=false` :) – xerx593 Nov 11 '22 at 09:26
  • Have you checked which one will be picked up? – khmarbaise Nov 11 '22 at 10:43
  • @ThorbjørnRavnAndersen I think your comment is the answer. If you add it as an answer, I can mark it as the correct one. – Harold L. Brown Jan 20 '23 at 19:35

0 Answers0