1

问题其实很简单。

我倾向于记得在这里看到过对 maven/jenkins 问题的回答,解释说可以通过使用 Jenkins 在启动 maven 构建时给出的属性激活这些配置文件来激活 Jenkins 中 maven 构建的某些部分。

但是詹金斯财产的名字是什么?那个财产价值是什么?

4

2 回答 2

5

您可以使用将由 Jenkins 中的环境变量自动激活的配置文件。

您可以使用以下方法之一,例如 JENKINS_HOME 或 JENKINS_URL 来激活配置文件:

BUILD_NUMBER
    The current build number, such as "153"
BUILD_ID
    The current build id, such as "2005-08-22_23-59-59" (YYYY-MM-DD_hh-mm-ss)
JOB_NAME
    Name of the project of this build, such as "foo" or "foo/bar"
BUILD_TAG
    String of "jenkins-${JOB_NAME}-${BUILD_NUMBER}". Convenient to put into a resource file, a jar file, etc for easier identification.
EXECUTOR_NUMBER
    The unique number that identifies the current executor (among executors of the same machine) that's carrying out this build. This is the number you see in the "build executor status", except that the number starts from 0, not 1.
NODE_NAME
    Name of the slave if the build is on a slave, or "master" if run on master
NODE_LABELS
    Whitespace-separated list of labels that the node is assigned.
WORKSPACE
    The absolute path of the directory assigned to the build as a workspace.
JENKINS_HOME
    The absolute path of the directory assigned on the master node for Jenkins to store data.
JENKINS_URL
    Full URL of Jenkins, like http://server:port/jenkins/
BUILD_URL
    Full URL of this build, like http://server:port/jenkins/job/foo/15/
JOB_URL
    Full URL of this job, like http://server:port/jenkins/job/foo/
SVN_REVISION
    Subversion revision number that's currently checked out to the workspace, such as "12345"
SVN_URL
    Subversion URL that's currently checked out to the workspace.
于 2013-01-09T17:17:15.513 回答
0

我这样做有点不同。例如,如果我想通过 Jenkins 启动集成测试,我有一个配置文件可以启动和停止集成测试服务器:

    <profile>
        <id>integration-test-wrapper</id>
        <activation>
            <property>
                <name>ci</name>
            </property>
        </activation>
        ...

Jenkins Build Config (Goals and Options) 我只是添加了参数-Dci

这将激活该配置文件。

于 2013-01-10T12:23:39.813 回答