WarningsPlugin无法从MSBuild收集警告 [英] WarningsPlugin not Collecting warnings from MSBuild

查看:187
本文介绍了WarningsPlugin无法从MSBuild收集警告的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试多分支工作.构建解决方案是可行的,但是无法解析由构建生成的警告.

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

这是我的Jenkinsfile:

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)

推荐答案

通过将msbuild的输出写入文本文件,然后将此文件用作警告插件的输入,解决了该问题

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: ''])
}

这篇关于WarningsPlugin无法从MSBuild收集警告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆