【问题标题】:How to generate an .hpi plugin from an existing project for jenkins如何从 jenkins 的现有项目中生成 .hpi 插件
【发布时间】:2016-09-24 23:11:14
【问题描述】:

我正在尝试使用 jenkins 的性能插件,但最新版本存在一些问题,如链接中所述:

https://issues.jenkins-ci.org/browse/JENKINS-27100

其中一个 cmets 是: “我认为这个问题已在主干中修复,签出并在本地构建似乎可以解决问题。我使用的是 Jenkins 版本 1.596.2”

我正在尝试做同样的事情,下载项目并在本地构建它。这是我不知道该怎么做的部分。我已经下载了eclipse(mars),但我什至不知道如何导入项目并构建它。

这是项目:

https://github.com/jenkinsci/performance-plugin

我已经下载并研究了如何导入它。显然这是一个 maven 项目(我知道 maven 可以创建 .hpi 文件)。但我无法更多地了解如何实际导入它。我可以尝试不同的教程,但我什至不确定我的方向是否正确。

我的计划是弄清楚如何将其作为 maven 项目导入并研究如何生成 .hpi。我猜这应该可行,如果我弄错了,请告诉我如何继续。

谢谢

更新

我已经能够在本地和 Eclipse 中安装 maven。但是,在这两种情况下,我都会遇到一些错误:

[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR : 
[INFO] -------------------------------------------------------------
[ERROR] Unable to locate the Javac Compiler in:
  C:\Program Files\Java\jre1.8.0_91\..\lib\tools.jar
Please ensure you are using JDK 1.4 or above and
not a JRE (the com.sun.tools.javac.Main class is required).
In most cases you can change the location of your Java
installation by setting the JAVA_HOME environment variable.
[INFO] 1 error
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 7.571 s
[INFO] Finished at: 2016-05-26T17:34:22-05:00
[INFO] Final Memory: 17M/248M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile (default-compile) on project performance: Compilation failure
[ERROR] Unable to locate the Javac Compiler in:
[ERROR] C:\Program Files\Java\jre1.8.0_91\..\lib\tools.jar
[ERROR] Please ensure you are using JDK 1.4 or above and
[ERROR] not a JRE (the com.sun.tools.javac.Main class is required).
[ERROR] In most cases you can change the location of your Java
[ERROR] installation by setting the JAVA_HOME environment variable.

现在,我已经在 J​​AVA_HOME 中设置了 jdk。我不确定我在这里会做错什么。

编辑 2

固定编辑 1。 我已经能够使用 -mvn 命令成功构建它。但是从eclipse我得到了错误:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.9:test (default-test) on project performance: There are test failures.
[ERROR] 
[ERROR] Please refer to E:\eclipseWorkSpace\performance-plugin-master\target\surefire-reports for the individual test results.
[ERROR] -> [Help 1]

只要错误仍然存​​在,我似乎就无法生成 .hpi。我正在尝试找出如何解决它,但到目前为止我还没有运气。

【问题讨论】:

    标签: java maven jenkins eclipse-plugin jenkins-plugins


    【解决方案1】:

    tutorial 是一个很好的起点

    您可以避免使用 IDE,直接运行

    mvn install
    

    从您放置源代码的目录中。您至少需要 maven3、JDK 6.0 和互联网连接以获取您需要的所有 jar 文件。

    【讨论】:

    【解决方案2】:

    对于那些没有在本地安装 Java JDK 的人来说,一个快速的方法是使用 docker。

    首先,创建一个卷以重用 Maven 本地存储库,而不是在每次构建时下载所有内容:

    docker volume create --name maven-repo
    

    那么,假设你在插件项目的根目录下:

    docker run --rm -it \
        -v maven-repo:/root/.m2 \
        -v "$(pwd)":/usr/src/mymaven \
        -w /usr/src/mymaven \
        maven:latest \
        mvn clean install
    

    您可以找到其他支持的 docker 标签来使用特定版本的 Java 或 Maven here

    【讨论】:

      猜你喜欢
      • 2015-03-28
      • 1970-01-01
      • 2012-10-27
      • 1970-01-01
      • 2012-02-18
      • 2017-05-16
      • 1970-01-01
      • 2013-06-01
      • 1970-01-01
      相关资源
      最近更新 更多