我需要使用Ant脚本将带有标签的文件从TFS服务器发送到另一个工作空间。基本上,我需要构建一个Java项目。我已经尝试了以下build.xml:
<?xml version="1.0" encoding="UTF-8"?>
<project name="test-teamprise-ant-tasks" basedir="C:/EARs/TFS" default="deploy">
<tstamp/>
<record name="log/build.log.${DSTAMP}${TSTAMP}" action="start" loglevel="verbose" append="true"/>
<property name="ant.lib.dir" value="C:/ant/lib"/>
<property name="tfs.server" value="http://tfsververurl:8080/tfs" />
<property name="tfs_workspace_name" value="TFSWORKSPCENAME"/>
<property name="tfs_project_name" value="$/PROJECT/CODE"/>
<typedef resource="com/teamprise/ant/antlib.xml"
classpath="${ant.lib.dir}/teamprise-ant-1.2.jar" />
<target name="diagnostics">
<tfstasksdiagnostics />
</target>
<target name="get" description="get the codes">
<echo message="Get latest source code from tfs"/>
<tfsget localpath="${basedir}/src" force="false" />
<tfsget localpath="${basedir}/WebRoot" force="false" />
</target>
<target name="deploy" depends="get" description=" get the codes,compile,package and deploy the output file">
<ant antfile="qk.xml"
dir="${basedir}"
inheritall="false"
inheritrefs="false"
target="war"/>
</target>
</project>
我收到以下问题:
Problem: failed to create task or type tfsget
Cause: The name is undefined.
Action: Check the spelling.
Action: Check that any custom tasks/types have been declared.
Action: Check that any <presetdef>/<macrodef> declarations have taken place.
at org.apache.tools.ant.UnknownElement.getNotFoundException(UnknownElement.java:481)
我还试图从互联网上找到teamprise-ant-1.2.jar。我无法得到它。
请帮助我解决此问题或向我建议如何使用TFS管理构建。
最佳答案
Microsoft acquired Teamprise in 2009。 teamprise.com网站似乎不再可用,因此可能很难找到teamprise-ant-1.2.jar的副本。
借助Internet存档Wayback机器,可以提供the older teamprise-ant-1.1.jar的副本。即使它是较旧的版本,它也支持<tfsget>
任务。试试看,看看它是否适合您。