java 蚂蚁与哈德森

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/5092479/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-30 09:23:06  来源:igfitidea点击:

Ant with Hudson

javasvnanthudson

提问by Kumar

I have problem in running the Job in Hudson. I have configured the Hudson with the ANT_HOME with the path of the ant and JDK as well with the relative path. And I created a New Job, where I setup the SVN path and rest of the things. My build.xml of the project is in Project root Folder/build/build.xml

我在 Hudson 运行 Job 时遇到问题。我已经使用 ANT_HOME 配置了 Hudson,其中包含 ant 和 JDK 的路径以及相对路径。我创建了一个新工作,在那里我设置了 SVN 路径和其余的东西。我的项目的 build.xml 在项目根文件夹/build/build.xml

And them I have added the build.xml in the Linux. Which is like this.

我在 Linux 中添加了 build.xml。这是这样的。

<project name="Test Job" default="build">
    <target name="clean">
        <delete dir="${basedir}/svn/_build"/>
        <delete dir="${basedir}/build"/>
    </target>
    <target name="prepare">
        <mkdir dir="${basedir}/svn/_build/logs"/>
        <mkdir dir="${basedir}/build/logs"/>
        <mkdir dir="${basedir}/build/docs"/>
    </target>
    <target name="build"
            depends="clean,prepare"/>
</project> 

Note : My I set my job name as usercentral.

注意:我将我的工作名称设置为 usercentral。

Then I tried build now on Hudson. It is giving me the below error.

然后我尝试在 Hudson 上构建。它给了我以下错误。

FATAL: command execution failed.Maybe you need to configure the job to choose one of your Ant installations?
java.io.IOException: Cannot run program "ant" (in directory "/root/.hudson/jobs/userCentral/workspace/branches/branches/build"): java.io.IOException: error=2, No such file or directory
    at java.lang.ProcessBuilder.start(ProcessBuilder.java:460)
    at hudson.Proc$LocalProc.(Proc.java:192)
    at hudson.Proc$LocalProc.(Proc.java:164)
    at hudson.Launcher$LocalLauncher.launch(Launcher.java:638)
    at hudson.Launcher$ProcStarter.start(Launcher.java:273)
    at hudson.Launcher$ProcStarter.join(Launcher.java:280)
    at hudson.tasks.Ant.perform(Ant.java:216)
    at hudson.tasks.BuildStepMonitor.perform(BuildStepMonitor.java:19)
    at hudson.model.AbstractBuild$AbstractRunner.perform(AbstractBuild.java:603)
    at hudson.model.Build$RunnerImpl.build(Build.java:172)
    at hudson.model.Build$RunnerImpl.doRun(Build.java:137)
    at hudson.model.AbstractBuild$AbstractRunner.run(AbstractBuild.java:417)
    at hudson.model.Run.run(Run.java:1362)
    at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
    at hudson.model.ResourceController.execute(ResourceController.java:88)
    at hudson.model.Executor.run(Executor.java:145)
Caused by: java.io.IOException: java.io.IOException: error=2, No such file or directory
    at java.lang.UNIXProcess.(UNIXProcess.java:148)
    at java.lang.ProcessImpl.start(ProcessImpl.java:65)
    at java.lang.ProcessBuilder.start(ProcessBuilder.java:453)
    ... 15 more
Finished: FAILURE

Can any one please help me.

谁能帮帮我吗。

采纳答案by limc

Append $ANT_HOME/binto your existing PATHin order for Hudson to be able to look for the ant command... or at least, that's how I fixed my same exact problem.

附加$ANT_HOME/bin到您的现有内容PATH,以便 Hudson 能够查找 ant 命令……或者至少,这就是我解决相同问题的方式。

回答by Daniel

Give hudson the absolute path to your ant installation. You can do this in the configs. Then just use this ant installation in your builds. You won't have to give an ANT_HOME.

给 hudson 安装 ant 的绝对路径。您可以在配置中执行此操作。然后在你的构建中使用这个 ant 安装。您不必提供 ANT_HOME。

回答by Jay R.

First, I told Hudson to use some version of Ant that it automatically installed and give that version of Ant a name. (From the Ant part of the Manage Hudson->Configure System page)

首先,我告诉 Hudson 使用它自动安装的某个版本的 Ant 并为该版本的 Ant 命名。(来自Manage Hudson->Configure System 页面的Ant 部分)

Second, I told the new project which named Ant to use. (From the Invoke Ant part of the project configuration"

其次,我告诉使用名为 Ant 的新项目。(来自项目配置的 Invoke Ant 部分”

回答by Riggy

Sounds like it could be a permissions issue. Does the hudson user have access to the directory path for all the relevant files and directories?

听起来可能是权限问题。hudson 用户是否有权访问所有相关文件和目录的目录路径?