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

FileNotFoundException when scanning compiler warnings in multibranch pipeline

    • Icon: Bug Bug
    • Resolution: Not A Defect
    • Icon: Minor Minor
    • warnings-plugin
    • Jenkins ver. 2.19.2, Linux RHEL7, warnings 4.57

      We used warnings plugin in a multibranch pipeline Jenkinsfile for a Maven Java project as follows:

        stage('Build') {
            maven '-DskipTests clean install -P TOMCAT'
            maven '-DskipTests clean install -P WAS'
            step([$class: 'WarningsPublisher', parserConfigurations: [[parserName: 'AspectJ Compiler (ajc)'], [parserName: 'Java Compiler (javac)']]])
        }
      

      This is incorrect usage (we found later that we must use "consoleParsers" instead of "parserConfigurations"), but Jenkins reports an unclear error in the job summary for each parser:

      Ajc Warnings: 0 warnings from one analysis.
      During parsing an error has been reported.

      Java Warnings: 0 warnings from one analysis.
      During parsing an error has been reported.

      The error is the same: the plugin tries to open a directory (as a file ?) and face FileNotFoundException:

      Module : Parsing of file /var/lib/jenkins/workspace/<project>-TYZ4HTMUDELQTO2KFI4T3R4ABMOEN4QPSBNFVWREXQY4ETHJWNNA failed due to an exception: 
      java.io.FileNotFoundException: /var/lib/jenkins/workspace/<project>-TYZ4HTMUDELQTO2KFI4T3R4ABMOEN4QPSBNFVWREXQY4ETHJWNNA (Is a directory)
        at java.io.FileInputStream.open0(Native Method) at java.io.FileInputStream.open(FileInputStream.java:195) 
        at java.io.FileInputStream.<init>(FileInputStream.java:138) 
        at hudson.plugins.warnings.parser.ParserRegistry.createReader(ParserRegistry.java:325) 
        at hudson.plugins.warnings.parser.ParserRegistry.parse(ParserRegistry.java:281) 
        at hudson.plugins.warnings.parser.ParserRegistry.parse(ParserRegistry.java:261) 
        at hudson.plugins.warnings.parser.FileWarningsParser.parse(FileWarningsParser.java:44) 
        at hudson.plugins.analysis.core.FilesParser.parseFile(FilesParser.java:325) 
        at hudson.plugins.analysis.core.FilesParser.parseFiles(FilesParser.java:283) 
        at hudson.plugins.analysis.core.FilesParser.parseSingleFile(FilesParser.java:241) 
        at hudson.plugins.analysis.core.FilesParser.invoke(FilesParser.java:200) 
        at hudson.plugins.analysis.core.FilesParser.invoke(FilesParser.java:31) 
        at hudson.FilePath.act(FilePath.java:1018) at hudson.FilePath.act(FilePath.java:996) 
        at hudson.plugins.warnings.WarningsPublisher.parseFiles(WarningsPublisher.java:400) 
        at hudson.plugins.warnings.WarningsPublisher.perform(WarningsPublisher.java:298) 
        at hudson.plugins.analysis.core.HealthAwarePublisher.perform(HealthAwarePublisher.java:68) 
        at hudson.plugins.analysis.core.HealthAwareRecorder.perform(HealthAwareRecorder.java:280) 
        at org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:69) 
        at org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:59) 
        at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$1$1.call(AbstractSynchronousNonBlockingStepExecution.java:52)
        at hudson.security.ACL.impersonate(ACL.java:221) 
        at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$1.run(AbstractSynchronousNonBlockingStepExecution.java:49) 
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) 
        at java.util.concurrent.FutureTask.run(FutureTask.java:266) 
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) 
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) 
        at java.lang.Thread.run(Thread.java:745)
      

          [JENKINS-39651] FileNotFoundException when scanning compiler warnings in multibranch pipeline

          Ulli Hafner added a comment -

          Can you please wrap your blocks in the description with noformat tags?

          Ulli Hafner added a comment - Can you please wrap your blocks in the description with noformat tags?

          Sure ! The description is updated as well, we found it was incorrect usage but the error was not clear.

          Vincent Privat added a comment - Sure ! The description is updated as well, we found it was incorrect usage but the error was not clear.

          Ulli Hafner added a comment - - edited

          Well, if you don't specify the pattern for the parserConfigurations then the default (**/*") is used.

          When you don't use (the new evil) project type pipeline then this would be clearly visible in the UI.

          Ulli Hafner added a comment - - edited Well, if you don't specify the pattern for the parserConfigurations then the default (** / *") is used. When you don't use (the new evil) project type pipeline then this would be clearly visible in the UI.

          trejkaz added a comment - - edited

          I'm getting this error too, but I can't understand what I'm supposed to change my config to by reading this ticket, or the source code of the task.

          What we have right now:

          step([$class: 'WarningsPublisher',
                parserConfigurations: [
                  [parserName: 'Java Compiler (javac)'],
                  [parserName: 'JavaDoc Tool']],
                unstableTotalAll: '0',
                usePreviousBuildAsReference: true])
          

          When I was writing the config, I also didn't understand why I had to provide a glob to match files, when what the warnings plugin is supposed to be parsing is the output log.

           This was adapted from examples on https://github.com/kitconcept/jenkins-pipeline-examples as we were unable to find any information in the docs for the warnings plugin itself.

          Some examples of correct usage would be really useful.

           

          trejkaz added a comment - - edited I'm getting this error too, but I can't understand what I'm supposed to change my config to by reading this ticket, or the source code of the task. What we have right now: step([$class: 'WarningsPublisher' , parserConfigurations: [ [parserName: 'Java Compiler (javac)' ], [parserName: 'JavaDoc Tool' ]], unstableTotalAll: '0' , usePreviousBuildAsReference: true ]) When I was writing the config, I also didn't understand why I had to provide a glob to match files, when what the warnings plugin is supposed to be parsing is the output log.  This was adapted from examples on https://github.com/kitconcept/jenkins-pipeline-examples  as we were unable to find any information in the docs for the warnings plugin itself. Some examples of correct usage would be really useful.  

          Ulli Hafner added a comment -

          trejkaz You need to use consoleParsers to parse the console log.

          Ulli Hafner added a comment - trejkaz You need to use consoleParsers to parse the console log.

          trejkaz added a comment -

          Are there syntax examples documented anywhere? Every example I see uses parserConfigurations, so it makes me wonder whether we're wrong to even want to use the console log.

          trejkaz added a comment - Are there syntax examples documented anywhere? Every example I see uses parserConfigurations, so it makes me wonder whether we're wrong to even want to use the console log.

          Ulli Hafner added a comment -

          I don't think so. You can create them on your own using the snippet generator.

          Ulli Hafner added a comment - I don't think so. You can create them on your own using the snippet generator.

            drulli Ulli Hafner
            don_vip Vincent Privat
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: