Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
735 views
in Technique[技术] by (71.8m points)

jenkins - WarningsPlugin not Collecting warnings from MSBuild

I am experimenting with a Multibranch job. Building the solution works, but parsing the warnings generated by the build fails.

this is my Jenkinsfile:

node {
    stage ('Checkout')
    {
        checkout scm
    }

    stage ('Build')
    {
        bat ""${tool 'MSBuild VS2013'}" Solution.sln /p:Configuration=Release /p:Platform="Any CPU" /p:ProductVersion=1.0.0.${env.BUILD_NUMBER}"
    }

    stage ('Warnings')
    {
        step([$class: 'WarningsPublisher', canComputeNew: false, canResolveRelativePaths: false, defaultEncoding: '', excludePattern: '', healthy: '', includePattern: '', messagesPattern: '', parserConfigurations: [[parserName: 'MSBuild']], unHealthy: ''])
    }
}

I get this Exception from the Warnings Plugin:

Projekt : Das Einlesen der Datei d:jenkins20configsworkspaceJenkinsFile_master-CQILFOMT634B5TYN4BWJKVHYYWABZMZHXNE4WK5BQE2E2MJN4MDQ ist wegen folgender Exception fehgeschlagen: java.io.FileNotFoundException: d:jenkins20configsworkspaceJenkinsFile_master-CQILFOMT634B5TYN4BWJKVHYYWABZMZHXNE4WK5BQE2E2MJN4MDQ (Zugriff verweigert)
 at java.io.FileInputStream.open0(Native Method)
 at java.io.FileInputStream.open(Unknown Source)
 at java.io.FileInputStream.<init>(Unknown Source)
 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:996)
 at hudson.FilePath.act(FilePath.java:974)
 at hudson.plugins.warnings.WarningsPublisher.parseFiles(WarningsPublisher.java:392)
 at hudson.plugins.warnings.WarningsPublisher.perform(WarningsPublisher.java:290)
 at hudson.plugins.analysis.core.HealthAwarePublisher.perform(HealthAwarePublisher.java:68)
 at hudson.plugins.analysis.core.HealthAwareRecorder.perform(HealthAwareRecorder.java:295)
 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:47)
 at hudson.security.ACL.impersonate(ACL.java:221)
 at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$1.run(AbstractSynchronousNonBlockingStepExecution.java:44)
 at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
 at java.util.concurrent.FutureTask.run(Unknown Source)
 at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
 at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
 at java.lang.Thread.run(Unknown Source)
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Solved the problem by writing the output from msbuild to a Textfile and then using this file as input for the warnings plugin

stage ('Checkout')
{
    checkout scm
}

stage ('Build')
{
    bat ""${tool 'MSBuild VS2013'}" Solution.sln /p:Configuration=Release /p:Platform="Any CPU" /p:ProductVersion=1.0.0.${env.BUILD_NUMBER} > msbuild.log 2>&1"
    bat " type msbuild.log"
}

stage ('Warnings')
{
    step([$class: 'WarningsPublisher', canComputeNew: false, canResolveRelativePaths: false, defaultEncoding: '', excludePattern: '', healthy: '', includePattern: '', messagesPattern: '', parserConfigurations: [[parserName: 'MSBuild', pattern: 'msbuild.log']], unHealthy: ''])
}

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...