在詹金斯中使用蚂蚁失败

using ant in jenkins failed

我在 Hudson 有一份工作,我已将其迁移到 Jenkins,但它在 Invoke Ant 构建步骤中失败。

BUILD FAILED D:..\build.xml:16: Problem: failed to create task or type svn Cause: The name is undefined. Action: Check the spelling. Action: Check that any custom tasks/types have been declared. Action: Check that any / declarations have taken place.

我的构建文件如下所示:

<property environment="env"/>

<property name="root.dir" value="${basedir}" />
<property name="bin.dir" value="${root.dir}/bin" />

<property name="user.svn" value="xxxx" />
<property name="pass.svn" value="xxxx" />

<target name="checkout-bin">
    <echo message="CHECKOUT" />
    <delete dir="${bin.dir}" />
    <svn javahl="false" username="${user.svn}" password="${pass.svn}">
        <checkout url="${url.svn}" revision="HEAD" destPath="${bin.dir}" />
    </svn>
</target>

我将构建步骤的 url.svn 作为 属性 url.svn=xxxxxxxx

svn 任务是 Ant 中的自定义任务,即它不是 echoproperty 等内置任务的一部分。您需要明确定义并导入该任务。

请参阅这个简短的 article 了解如何操作。基本上它是这样的:

<path id="svnant.classpath">
    <fileset dir="${svnant.lib.dir}">
        <include name="**/*.jar" />
    </fileset>
</path>

<typedef resource="org/tigris/subversion/svnant/svnantlib.xml" classpathref="svnant.classpath" />

我不知道它以前在旧的 Hudson 上是如何工作的,但它肯定是在 Ant 类路径中的某个地方定义的。