Reputation: 2197
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:\jenkins20\configs\workspace\JenkinsFile_master-CQILFOMT634B5TYN4BWJKVHYYWABZMZHXNE4WK5BQE2E2MJN4MDQ ist wegen folgender Exception fehgeschlagen: java.io.FileNotFoundException: d:\jenkins20\configs\workspace\JenkinsFile_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)
Upvotes: 2
Views: 1930
Reputation: 938
There is a new way to do this. First you could use the Code Snippet Generator, it's easy and fast and gets the job done. It would look kinda like this:
stage('Warning') {
steps {
warnings canComputeNew: false, canResolveRelativePaths: false, categoriesPattern: '', consoleParsers: [[parserName: 'MSBuild']], defaultEncoding: '', excludePattern: '', healthy: '', includePattern: '', messagesPattern: '', unHealthy: ''
}
}
Upvotes: 1
Reputation: 2197
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: ''])
}
Upvotes: 3