6
回答
请教如何使用ant 从 svn上下载文件 的具体步骤

请教下大家 如何使用ant 从 svn上下载文件 的具体步骤

  小弟我第一次接触这个东东,有点模糊。请大家帮忙。

  我已经下载了svnant-1.3.0,并且用自带的build.xml生成了 src_1.3.0文件夹,  可是在这个里面没有找到build文件夹 也没有找到新生成svnant.jar.

   继续不下去了,  哪位大侠帮忙指点下啊.

最好有详细的介绍

举报
genghuan
发帖于8年前 6回/9K+阅
共有6个答案 最后回答: 6年前

我试了一下,有几个地方不明白

1、svnant.jar在系统classpath中 

这里改怎么设置呢 在系统变量里面设置 C:\ant\lib\svnant.jar   ?  我的ant 在C盘根目录

2、使用前需要将它依赖的类库放在ant安装目录下面的lib目录

依赖的类库有哪些呢?javasvn.jar、javasvn-javahl.jar、svnClientAdapter.jar?

 

以下是我的程序代码

<?xml version="1.0"?>
<project name="SVN Ant Test" default="export" basedir=".">
<typedef resource="org/tigris/subversion/svnant/svnantlib.xml" classpath="svnant.jar"/>
<target name="export">
<svn javahl="true" username="test" password="password" failonerror="false">
<export srcUrl="svn://192.168.0.112/svn/GameDesign//" destPath="c:/temp/src2" revision="HEAD"/>
</svn>
</target>
</project>

 

提示错误 [typedef] Could not load definitions from resource org/tigris/subversion/svnant/svnantlib.xml. It could not be found.

可是我解压c:/ant/lib/svnant.jar 发现有这个"org/tigris/subversion/svnant/svnantlib.xml"

难道是环境变量的问题?

还是有错

  具体错误如下:

Buildfile: C:\program\工程\svnant\testsvn.xml
  [typedef] Could not load definitions from resource org/tigris/subversion/svnant/svnantlib.xml. It could not be found.
export:

BUILD FAILED
C:\program\?·??¨?\svnant\testsvn.xml:5: Could not create task or type of type: svn.

Ant could not find the task or a class this task relies upon.

This is common and has a number of causes; the usual
solutions are to read the manual pages then download and
install needed JAR files, or fix the build file:
 - You have misspelt 'svn'.
   Fix: check your spelling.
 - The task needs an external JAR file to execute
     and this is not found at the right place in the classpath.
   Fix: check the documentation for dependencies.
   Fix: declare the task.
 - The task is an Ant optional task and the JAR file and/or libraries
     implementing the functionality were not found at the time you
     yourself built your installation of Ant from the Ant sources.
   Fix: Look in the ANT_HOME/lib for the 'ant-' JAR corresponding to the
     task and make sure it contains more than merely a META-INF/MANIFEST.MF.
     If all it contains is the manifest, then rebuild Ant with the needed
     libraries present in ${ant.home}/lib/optional/ , or alternatively,
     download a pre-built release version from apache.org
 - The build file was written for a later version of Ant
   Fix: upgrade to at least the latest release version of Ant
 - The task is not an Ant core or optional task
     and needs to be declared using <taskdef>.
 - You are attempting to use a task defined using
    <presetdef> or <macrodef> but have spelt wrong or not
   defined it at the point of use

Remember that for JAR files to be visible to Ant tasks implemented
in ANT_HOME/lib, the files must be in the same directory or on the
classpath

Please neither file bug reports on this problem, nor email the
Ant mailing lists, until all of these causes have been explored,
as this is not an Ant bug.

Total time: 95 milliseconds

问题解决了

      我用eclipse来编辑的,所以需要导入 svnant.jar , svnClientAdapter.jar , svnjavahl.jar , svnkit.jar 到eclipse里面。

多谢大家的关注.  

  谢谢 红薯  的帮忙。

顶部