0

I have some bash script which contains this command:

$MAVEN -f "${PROJECTROOT}/pom.xml" org.apache.maven.plugins:maven-release-plugin:2.4.1:prepare -Darguments="-DskipTests"

The problem is that the tests aren't skipped. I'v checked this issue which provided the right command to skip the tests. The command works when I try the same command locally on my machine using mvn and using no enviroment variabeles.

Now I'm using this as managed script in Jenkins where it seems to fail every time. The tests aren't skipped. What am I doing wrong?

The mvn version on our Jenkins is 3.2.5

carlspring
  • 31,231
  • 29
  • 115
  • 197
DenCowboy
  • 13,884
  • 38
  • 114
  • 210
  • I think the problem is that you can't skip the tests on release:prepare, it would defeat the object of the plugin. – Essex Boy Oct 24 '17 at 14:46
  • @EssexBoy thanks, but when I run it locally on a different project with I get:[INFO] [INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ mum-springclient-javaconfig --- [INFO] [INFO] Tests are skipped. – DenCowboy Oct 24 '17 at 14:52
  • Strange, you are using the proper syntax. Maybe this is caused by something else in your script. Can you please share the complete related Jenkins log and the script? – Pierre B. Oct 25 '17 at 08:52
  • It's really just like that and still executing the tests. I'm afraid it's some profile or something in my pom.xml which is forcing to run tests. Is that possible? – DenCowboy Oct 25 '17 at 09:03

1 Answers1

0

If you look at the the mvn command in the script mvn, mine look like this :

exec "$JAVACMD" \
  $MAVEN_OPTS \
  $MAVEN_DEBUG_OPTS \
  -classpath "${M2_HOME}"/boot/plexus-classworlds-*.jar \
  "-Dclassworlds.conf=${M2_HOME}/bin/m2.conf" \
  "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \
  ${CLASSWORLDS_LAUNCHER} "$@"

So the -DskipTests is just a java system argument, as part of the $@ catch-all.

You should look at your $MAVEN script

Essex Boy
  • 7,565
  • 2
  • 21
  • 24
  • Your command looks advanced. In mine the $MAVEN just contains the path to my mvn executable. In a very easy way my command is: ´mvn release:prepeare -Darguments="-DskipTests" -DskipTests´ – DenCowboy Oct 25 '17 at 05:49