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

Warnings Plugin cannot show details for MSBuild warnings

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • warnings-plugin
    • Windows 7 x64, US English
      MSBuild 12.0.30110.0
      Single Jenkins server running on this machine. No slaves involved.

      Warnings Plugin set to "Scan console log"
      Parser set to MSBuild

      Warnings Plugin correctly identifies the warning and shows its summary in the "MSBuild Warnings" page.
      However, when I click on the link to show the file containing the specific warning, I get a stack trace from java.io.FileInputStream.open (attached).

      Additional info:
      I tried this with "Resolve relative paths" both checked and unchecked. It did not seem to make any difference.
      I also tried using MSBuild both with and without the "/m" command-line option for building multiple projects in parallel. This option changes the console log format by appending the parallel build number to all lines of text. The Warnings Plugin was not affected by either setting of /m.

      I think the problem is caused by MSBuild's output format which is:
      Filename(line,column) : warning <number>: description [full path to project file]

      I think the solution is to get the directory from project file and then append the relative filename of the file containing the warning. For example:
      PbuAfg.cs(90,9): warning CS0168: The variable 'warnme' is declared but never used [C:\Program Files (x86)\Jenkins\workspace\gurb\Platforms\Afg\PbuAfg\PbuAfg.csproj]

      The file containing the warning is: PbuAfg.cs
      The project file is: C:\Program Files (x86)\Jenkins\workspace\gurb\Platforms\Afg\PbuAfg\PbuAfg.csproj

      Get the directory part of the project: C:\Program Files (x86)\Jenkins\workspace\gurb\Platforms\Afg\PbuAfg\
      Append the filename: C:\Program Files (x86)\Jenkins\workspace\gurb\Platforms\Afg\PbuAfg\PbuAfg.cs

      This yields the full path to the file.

          [JENKINS-22386] Warnings Plugin cannot show details for MSBuild warnings

          John McCabe added a comment - - edited

          Same general issue as JENKINS-14064; warnings plugin struggling with relative paths in output. I raised JENKINS-15801 as a possible workaround which would be to specify the root path somewhere in the warnings plugin configuration for a job. That way the plugin should just be able to get the absolute path by working it out from the root. It was just a thought but...

          John McCabe added a comment - - edited Same general issue as JENKINS-14064 ; warnings plugin struggling with relative paths in output. I raised JENKINS-15801 as a possible workaround which would be to specify the root path somewhere in the warnings plugin configuration for a job. That way the plugin should just be able to get the absolute path by working it out from the root. It was just a thought but...

          David Aldrich added a comment -

          I, also, am seeing this problem when using the MSBuild parser. Has any progress been made to resolve it?

          David Aldrich added a comment - I, also, am seeing this problem when using the MSBuild parser. Has any progress been made to resolve it?

          David Aldrich added a comment -

          This problem still manifests itself in Warnings plugin 4.42.

          David Aldrich added a comment - This problem still manifests itself in Warnings plugin 4.42.

          Ulli Hafner added a comment -

          I think nobody is working on a solution up to now. If you are interested in helping please let me know...

          Ulli Hafner added a comment - I think nobody is working on a solution up to now. If you are interested in helping please let me know...

          Code changed in jenkins
          User: Daniel Grunwald
          Path:
          src/main/java/hudson/plugins/warnings/parser/MsBuildParser.java
          src/test/java/hudson/plugins/warnings/parser/MsBuildParserTest.java
          src/test/resources/hudson/plugins/warnings/parser/issue22386.txt
          http://jenkins-ci.org/commit/warnings-plugin/ee7f89c66330a8b861f78d2b1fa57e5fad946637
          Log:
          JENKINS-22386 MSBuild parser: resolve paths relative to project directory

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Daniel Grunwald Path: src/main/java/hudson/plugins/warnings/parser/MsBuildParser.java src/test/java/hudson/plugins/warnings/parser/MsBuildParserTest.java src/test/resources/hudson/plugins/warnings/parser/issue22386.txt http://jenkins-ci.org/commit/warnings-plugin/ee7f89c66330a8b861f78d2b1fa57e5fad946637 Log: JENKINS-22386 MSBuild parser: resolve paths relative to project directory

          Code changed in jenkins
          User: Ulli Hafner
          Path:
          src/main/java/hudson/plugins/warnings/parser/MsBuildParser.java
          src/test/java/hudson/plugins/warnings/parser/MsBuildParserTest.java
          src/test/resources/hudson/plugins/warnings/parser/issue22386.txt
          http://jenkins-ci.org/commit/warnings-plugin/3df082c84b743aa72a89caa731c9ef68e27a7e4f
          Log:
          Merge pull request #67 from dgrunwald/msbuild_resolve_paths

          [FIXED JENKINS-22386] MSBuild parser: resolve paths relative to project dir.

          Compare: https://github.com/jenkinsci/warnings-plugin/compare/74a00659a60f...3df082c84b74

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Ulli Hafner Path: src/main/java/hudson/plugins/warnings/parser/MsBuildParser.java src/test/java/hudson/plugins/warnings/parser/MsBuildParserTest.java src/test/resources/hudson/plugins/warnings/parser/issue22386.txt http://jenkins-ci.org/commit/warnings-plugin/3df082c84b743aa72a89caa731c9ef68e27a7e4f Log: Merge pull request #67 from dgrunwald/msbuild_resolve_paths [FIXED JENKINS-22386] MSBuild parser: resolve paths relative to project dir. Compare: https://github.com/jenkinsci/warnings-plugin/compare/74a00659a60f...3df082c84b74

            drulli Ulli Hafner
            redtracy Bob Tracy
            Votes:
            5 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved: