【问题标题】:NullPointerException when trying to create allure report by allure-jenkins-plugin尝试通过 allure-jenkins-plugin 创建魅力报告时出现 NullPointerException
【发布时间】:2015-04-30 17:22:46
【问题描述】:

当我尝试通过 allure-jenkins-plugin 创建魅力报告时,我收到这样的错误:

ERROR: Publisher ru.yandex.qatools.allure.jenkins.AllureReportPublisher aborted due to exception
java.io.IOException: java.lang.NullPointerException
    at ru.yandex.qatools.allure.jenkins.utils.ReportGenerator.invoke(ReportGenerator.java:50)
    at ru.yandex.qatools.allure.jenkins.utils.ReportGenerator.invoke(ReportGenerator.java:25)
    at hudson.FilePath.act(FilePath.java:991)
    at hudson.FilePath.act(FilePath.java:969)
    at ru.yandex.qatools.allure.jenkins.AllureReportPublisher.generateReport(AllureReportPublisher.java:267)
    at ru.yandex.qatools.allure.jenkins.AllureReportPublisher.perform(AllureReportPublisher.java:146)
    at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
    at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:764)
    at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:724)
    at hudson.model.Build$BuildExecution.post2(Build.java:185)
    at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:671)
    at hudson.model.Run.execute(Run.java:1769)
    at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
    at hudson.model.ResourceController.execute(ResourceController.java:98)
    at hudson.model.Executor.run(Executor.java:374)
Caused by: java.lang.NullPointerException
    at ru.yandex.qatools.clay.internal.AetherUtils.getRepositoriesAsList(AetherUtils.java:183)
    at ru.yandex.qatools.clay.Aether.<init>(Aether.java:60)
    at ru.yandex.qatools.clay.Aether.aether(Aether.java:78)
    at ru.yandex.qatools.allure.jenkins.utils.ReportGenerator.createAether(ReportGenerator.java:69)
    at ru.yandex.qatools.allure.jenkins.utils.ReportGenerator.invoke(ReportGenerator.java:45)
    ... 14 more

allure 创建的 xml-file 是有效的(我可能会使用相同的 xml 使用 maven 目标“站点”创建正确的报告),所以问题一定出在 jenkins 插件中。

我已经安装了 maven 3.2.5,settings.xml 存在于 ~/.m2 目录中,似乎是正确的。

出现这种错误的原因可能是什么?似乎它与 maven 设置有某种联系。

【问题讨论】:

  • 查看插件的代码和AetherUtils,并不清楚为什么会发生这种情况。该插件似乎有一些糟糕的发布管理实践,但似乎(与大多数 Jenkins 插件不同)您应该尝试在此处将其报告为错误:github.com/allure-framework/allure-jenkins-plugin/issues

标签: maven jenkins allure


【解决方案1】:

问题出在 maven settings.xml 文件中,在

<activeProfiles> 

部分。它包含配置文件,实际上并不存在。删除此配置文件解决了问题。

【讨论】:

    【解决方案2】:

    这可能是由于:

    1. Jenkins 中没有安装 Allure。

    步骤:

    Go to Manage Jenkins > 
    Global Tool Configuration >
    Allure Commandline > 
    Add Allure Commandline > 
    Uncheck "Install automatically"
    

    从 maven repo 下载最新的 allure 命令行 - https://repo.maven.apache.org/maven2/io/qameta/allure/allure-commandline/

    解压文件并提供位置

    安装目录:C:\allure-2.17.2 (I am using windows, jenkin)

    【讨论】:

      猜你喜欢
      • 2023-03-31
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多