2012-12-05 136 views
1

我在Ubuntu 12上运行TeamCity 7,我试图部署一个战争文件到机器上的一个Tomcat服务器与IP x使用Ant。 事情是这样的 - 这与TeamCity 7在另一台机器上工作,我唯一改变的是机器(移到Ubuntu上运行的KVM)和TC版本(升级)。TeamCity部署到Tomcat与蚂蚁失败

  1. 我已经设置ANT_HOME到正确的位置,我看的TC是在生成日志使用它: ... -Dant.home =的/ usr /共享/蚂蚁...

  2. 我已经添加了以下罐子我ANT_HOME/lib目录下: 卡塔利娜蚁,Tomcat的土狼,Tomcat的巨力,Tomcat的UTIL

  3. 构建是在具有默认设置蚂蚁代理运行

  4. 我的Ant文件看起来是这样的:

<target name="deploy.to.server"> 
    <property name="port" value="${tomcat.port}"/> 
    <property name="tomcat.manager" value="manager/text"/> 
    <property name="url" value="http://${tomcat.server}:${port}/${tomcat.manager}"/> 
    <property name="path" value="/${server.name}"/> 

    <echo message="Deploying application to ${url}"/> 

    <antcall target="undeploy.from.tomcat"/> 
    <sleep seconds="3"/> 
    <antcall target="deploy.to.tomcat"/> 
</target> 

<taskdef name="deploy" classname="org.apache.catalina.ant.DeployTask"/> 
<taskdef name="undeploy" classname="org.apache.catalina.ant.UndeployTask"/> 

<target name="deploy.to.tomcat" description="Install web application"> 
    <deploy url="${url}" username="${username}" password="${password}" 
      path="${path}" war="${work.dir}/${path}.war"/> 
</target> 

<target name="undeploy.from.tomcat" description="Remove web application"> 
    <undeploy url="${url}" username="${username}" password="${password}" 
      path="${path}"/> 
</target> 

我在TC日志得到这个:

[Step 1/2] Starting: /usr/lib/jvm/java-6-openjdk-amd64/jre/bin/java -Dagent.home.dir=/home/system/dev/TeamCity/buildDeployAgent -Dagent.name=Deploy Agent -Dagent.ownPort=9091 -Dagent.work.dir=/home/system/dev/TeamCity/buildDeployAgent/work -Dant.home=/usr/share/ant -Dbuild.number=131 -Dbuild.vcs.number.Nutrino_Monitor_sources=588 -Dbuild.vcs.number.Nutrino_build_scripts=590 -Dfile.encoding=ANSI_X3.4-1968 -Dfile.separator=/ -Djava.io.tmpdir=/home/system/dev/TeamCity/buildDeployAgent/temp/buildTmp -Dos.arch=amd64 -Dos.name=Linux -Dos.version=3.5.0-19-generic -Dpath.separator=: -Dteamcity.agent.cpuBenchmark=684 -Dteamcity.agent.dotnet.agent_url=http://localhost:9091/RPC2 -Dteamcity.agent.dotnet.build_id=45574 -Dteamcity.auth.password=mlTjdmhOxwfxuM6vGfcQPsKg81q29rFU -Dteamcity.auth.userId=TeamCityBuildId=45574 -Dteamcity.build.changedFiles.file=/home/system/dev/TeamCity/buildDeployAgent/temp/buildTmp/changedFiles7524737972530602224.txt -Dteamcity.build.checkoutDir=/home/system/dev/TeamCity/Builds/DeployNutritionServer -Dteamcity.build.id=45574 -Dteamcity.build.properties.file=/home/system/dev/TeamCity/buildDeployAgent/temp/buildTmp/teamcity.build3049879068391711216.properties -Dteamcity.build.tempDir=/home/system/dev/TeamCity/buildDeployAgent/temp/buildTmp -Dteamcity.build.workingDir=/home/system/dev/TeamCity/Builds/DeployNutritionServer -Dteamcity.buildConfName=Deploy to Integration -Dteamcity.buildType.id=bt38 -Dteamcity.configuration.properties.file=/home/system/dev/TeamCity/buildDeployAgent/temp/buildTmp/teamcity.config301718488736388101.properties -Dteamcity.projectName=Nutrition Builds -Dteamcity.runner.properties.file=/home/system/dev/TeamCity/buildDeployAgent/temp/buildTmp/teamcity.runner1078243400245029410.properties -Dteamcity.runtime.props.file=/home/system/dev/TeamCity/buildDeployAgent/temp/agentTmp/ant7992360137092769527runtime -Dteamcity.tests.recentlyFailedTests.file=/home/system/dev/TeamCity/buildDeployAgent/temp/buildTmp/testsToRunFirst5600043147441131768.txt -Dteamcity.version=7.1.2 (build 24170) -Dtomcat.server=integration -Duser.country=US -Duser.home=/home/system -Duser.language=en -Duser.name=system -Duser.timezone=Asia/Jerusalem -Dwork.dir=/home/system/dev/TeamCity/Builds/DeployNutritionServer -classpath /usr/share/java/ant-launcher-1.8.2.jar org.apache.tools.ant.launch.Launcher -lib /home/system/dev/TeamCity/buildDeployAgent/plugins/antPlugin/ant-runtime.jar:/home/system/dev/TeamCity/buildDeployAgent/lib/runtime-util.jar -listener jetbrains.buildServer.agent.ant.AgentBuildListener -buildfile /home/system/dev/TeamCity/Builds/DeployNutritionServer/build/deploy.xml deploy.nutrino.server 
[15:06:21][Step 1/2] in directory: /home/system/dev/TeamCity/Builds/DeployNutritionServer 
[15:06:21][Step 1/2] taskdef 
[15:06:21] 
[taskdef] taskdef class org.apache.catalina.ant.DeployTask cannot be found 
using the classloader AntClassLoader[] 
[15:06:21] 
[Step 1/2] The following error occurred while executing this line: 
/home/system/dev/TeamCity/Builds/DeployNutritionServer/build/tomcat.tasks.xml:9: taskdef class org.apache.catalina.ant.DeployTask cannot be found 
using the classloader AntClassLoader[] 
[15:06:21][Step 1/2] Process exited with code 1 
[15:06:21][Step 1/2] Ant output 
[15:06:21][Ant output] Buildfile: /home/system/dev/TeamCity/Builds/DeployNutritionServer/build/deploy.xml 
[15:06:21][Ant output] 
[15:06:21][Ant output] BUILD FAILED 
[15:06:21][Ant output] /home/system/dev/TeamCity/Builds/DeployNutritionServer/build/deploy.xml:8: The following error occurred while executing this line: 
[15:06:21][Ant output] /home/system/dev/TeamCity/Builds/DeployNutritionServer/build/tomcat.tasks.xml:9: taskdef class org.apache.catalina.ant.DeployTask cannot be found 
[15:06:21][Ant output] using the classloader AntClassLoader[] 
[15:06:21][Ant output] 
[15:06:21][Ant output] Total time: 0 seconds 
[15:06:22][Step 1/2] Step Deploy (Ant) failed 

现在,这是非常奇怪的,因为当我运行这个从它的工作完美的命令行: ant -buildfile deploy.xml -Domomcat.server = ...

没有appare两者之间的区别 - 从CL运行它并通过TC代理应该都从ANT_HOME(usr/share/ant)运行Ant,并将这些库加载到$ ANT_HOME/lib中。

任何帮助,将不胜感激。 :)

谢谢!

+1

是在'$ ANT_HOME/lib'了'卡特琳娜 - ant.jar'可用?否则,定义一个路径元素并将其添加到'taskdef'元素。 – timomeinen

+0

是的,这是问题所在,我把它放在箱子里,而不是... 谢谢! –

回答

0

只需回答这个问题,

感谢@timomeinen - 添加卡塔利娜 - ant.jar文件到$ ANT_HOME/lib中所做的工作。

0

这意味着它是没有看到的lib卡塔利娜 - ant.jar文件

您可以添加:

类名= “org.apache.catalina.ant.DeployTask”
CLASSPATH =“C: \ Programming \ Tomcat \ Instances \ 8080 \ lib \ catalina-ant.jar“

它会解决这个参考问题,但我想你以后会遇到与其他库类似的问题,所以从长远来看,仍然需要解决参考问题。