如何在Job DSL中使用EnvInject插件

时间:2016-02-26 03:36:35

标签: maven jenkins jenkins-plugins jenkins-cli jenkins-job-dsl

我相信生成的config.xml看起来如下所示:

<EnvInjectJobProperty plugin="envinject@1.92.1">
    <info>
        <propertiesContent>
            MAVEN_HOME=/opt/maven/apache-maven-3.2.5
            JAVA_HOME=/opt/java/java8
        </propertiesContent>
        <loadFilesFromMaster>false</loadFilesFromMaster>
    </info>
    <on>true</on>
    <keepJenkinsSystemVariables>true</keepJenkinsSystemVariables>
    <keepBuildVariables>true</keepBuildVariables>
    <overrideBuildParameters>false</overrideBuildParameters>
    <contributors/>
</EnvInjectJobProperty>

1 个答案:

答案 0 :(得分:0)

您不应该使用EnvInject配置MAVEN_HOMEJAVA_HOME这应该通过相应作业中的配置来完成。

mavenJob {
  jdk (..)
  mavenInstallation(...)..
}

freestyleJob {
  jdk (..)
}