Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-5651

Tests not executed when MAVEN_OPTS contains newlines

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • maven-plugin
    • None

      Tests are not executed (nether coverage) when configuring a maven 2 build and specifying MAVEN_OPTS on multiple lines like this :

      -XX:MaxPermSize=512m
      -Xms128m
      -Xmx512m
      

      With an mvn help:effective-pom, I can see the following, which probably disturb maven (with no complain) :

      <plugin>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.4.1</version>
                <configuration>
                  <argLine>-XX:MaxPermSize=512m
      -Xms128m
      -Xmx512m</argLine>
      [...]
      </plugin>
      

      If I put all options on the same line, tests are well executed. It should be good to remove new line when passing to Maven.

          [JENKINS-5651] Tests not executed when MAVEN_OPTS contains newlines

          Andrew Bayer added a comment -

          Clarifying summary.

          Andrew Bayer added a comment - Clarifying summary.

          jeromevdl added a comment -

          I don't know what more can i tell... The field MAVEN_OPTS (in Build / Advanced) can be on one line (simple input) and can be extended on several lines (textarea).

          When writing options separated by new lines in the textarea, tests are not executed:

          -XX:MaxPermSize=512m
          -Xms128m
          -Xmx512m

          (probably because of the argLine parameter of surefire in the pom)

          When writing on one line in input text, tests are executed.

          -XX:MaxPermSize=512m -Xms128m -Xmx512m

          jeromevdl added a comment - I don't know what more can i tell... The field MAVEN_OPTS (in Build / Advanced) can be on one line (simple input) and can be extended on several lines (textarea). When writing options separated by new lines in the textarea, tests are not executed: -XX:MaxPermSize=512m -Xms128m -Xmx512m (probably because of the argLine parameter of surefire in the pom) When writing on one line in input text, tests are executed. -XX:MaxPermSize=512m -Xms128m -Xmx512m

          Andrew Bayer added a comment -

          Ok, it looks like this is even more of a special case than I initially thought - it's that the MAVEN_OPTS environment variable containing newlines can cause problems if you then try to reuse that environment variable somewhere that expects it to just be one line. I think I can fix this pretty easily, but it is a bit weird.

          Andrew Bayer added a comment - Ok, it looks like this is even more of a special case than I initially thought - it's that the MAVEN_OPTS environment variable containing newlines can cause problems if you then try to reuse that environment variable somewhere that expects it to just be one line. I think I can fix this pretty easily, but it is a bit weird.

          Code changed in hudson
          User: : abayer
          Path:
          trunk/hudson/main/core/src/main/java/hudson/tasks/Maven.java
          trunk/hudson/main/maven-plugin/src/main/java/hudson/maven/MavenModuleSet.java
          trunk/hudson/main/test/src/test/java/hudson/maven/MavenOptsTest.java
          trunk/hudson/main/test/src/test/resources/hudson/maven/maven-surefire-unstable.zip
          trunk/www/changelog.html
          http://jenkins-ci.org/commit/27559
          Log:
          [FIXED JENKINS-5651] Removing excess whitespace from MAVEN_OPTS

          SCM/JIRA link daemon added a comment - Code changed in hudson User: : abayer Path: trunk/hudson/main/core/src/main/java/hudson/tasks/Maven.java trunk/hudson/main/maven-plugin/src/main/java/hudson/maven/MavenModuleSet.java trunk/hudson/main/test/src/test/java/hudson/maven/MavenOptsTest.java trunk/hudson/main/test/src/test/resources/hudson/maven/maven-surefire-unstable.zip trunk/www/changelog.html http://jenkins-ci.org/commit/27559 Log: [FIXED JENKINS-5651] Removing excess whitespace from MAVEN_OPTS

            abayer Andrew Bayer
            jeromevdl jeromevdl
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: