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

withSonarQubeEnv not displaying actual error information

XMLWordPrintable

      When running a maven build that causes an error within a withSonarQubeEnv the actual error message is not displayed in any log or console output.

      The setup in our Jenkinsfile is as follows:

       

      def rtMaven = Artifactory.newMavenBuild()
      rtMaven.tool = 'MAVEN_DEFAULT'
      
      // snip
      withSonarQubeEnv('sonarqube') {
        rtMaven.run pom: pomFile, goals: "clean install sonar:sonar -DskipTests", buildInfo: buildInfo
      }
      

      And there is an exception thrown due to a lib vs. java version conflict:

      [...]
      Downloaded from central: https://[...]/commons-logging-1.0.4.jar (38 kB at 17 kB/s)
      Downloaded from central: https://[...]/aspectjtools-1.6.11.jar (8.9 MB at 2.7 MB/s)
      org.aspectj.apache.bcel.classfile.ClassFormatException: Invalid byte tag in constant pool: 18
        at org.aspectj.apache.bcel.classfile.Constant.readConstant(Constant.java:133)
        at org.aspectj.apache.bcel.classfile.ConstantPool.<init> ConstantPool.java:45)
      [...]

      This exception is displayed when running mvn by hand and also when moving the rtMaven.run part out of the withSonarQubeEnv block.

      When run within that block the console only displays

      [...]
      Progress (1): 8.9 MB    
                          
      Downloaded from artifactory-release: https://[...]/aspectjtools-1.6.11.jar (8.9 MB at 3.1 MB/s)
      [Pipeline] }
      WARN: Unable to locate 'report-task.txt' in the workspace. Did the SonarScanner succedeed?
      [Pipeline] // withSonarQubeEnv
      [Pipeline] }
      [Pipeline] // stage
      [Pipeline] }
      [Pipeline] // node
      [Pipeline] echo
      Promote to Release Repository aborted...
      [Pipeline] End of Pipeline
      java.lang.RuntimeException: Maven build failed
      	at org.jfrog.hudson.pipeline.steps.ArtifactoryMavenBuild$Execution.run(ArtifactoryMavenBuild.java:110)
      [...]

      Where the latter exception is caught and dumped using our pipeline code.

      This lack of information makes it hard to find and analyse errors.

       

            sonarteam Sonar Team
            kpshi karoshi
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: