【问题标题】:Using SVNAnt in eclipse Build Failed (Could not load definitions from resource)在 Eclipse 中使用 SVNAnt 构建失败(无法从资源加载定义)
【发布时间】:2011-12-29 15:25:24
【问题描述】:

我想在 Eclipse 中使用 SVNAnt。 但是当我运行我的脚本时,我收到了这条消息:

Buildfile: X:\XXX\bin\ant\axis_bujava.xml
  [typedef] Could not load definitions from resource org/tigris/subversion/svnant/svnantlib.xml. It could not be found.
testSVNAnt:

BUILD FAILED
X:\XXX\bin\ant\axis_bujava.xml:11: 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 <presetdef>/<macrodef> declarations have taken place.

这是 Ant 构建文件:

<?xml version="1.0"?>

<project default="testSVNAnt" basedir=".">

<path id="path.svnant">
    <pathelement location="${basedir}/svnant.jar"/>
    <pathelement location="${basedir}/svnClientAdapter.jar"/>
</path>
<typedef resource="org/tigris/subversion/svnant/svnantlib.xml" classpathref="path.svnant" />
    <target name="testSVNAnt">
        <svn username="username" password="pass">
            <checkout url="svn://svnurl" destPath="localpath" revision="HEAD"/>  
        </svn>
        <echo message= "Subversion repository url: ${repository.url}" />
    </target>
</project>

JAR 文件当然是在 basedir 中。我找不到类似的问题,也找不到任何解决方案。

【问题讨论】:

    标签: eclipse svn ant


    【解决方案1】:

    你必须使用

    <taskdef />
    

    而不是&lt;typedef/&gt;

    其他一切看起来都很好。

    【讨论】:

    • 这个修改对我没有任何改变。
    • @thomaf 你能验证 org/tigris/subversion/svnant/svnantlib.xml 是否在 svnant.jar 中
    【解决方案2】:

    它最终使用 SvnAnt 1.3.1 工作。

    使用此代码结帐工作正常:

    <?xml version="1.0"?>
    
    <project default="main" basedir=".">
    
        <path id="path.svnant">
            <pathelement location="${basedir}/svnant.jar" />
            <pathelement location="${basedir}/svnClientAdapter.jar" />
            <pathelement location="${basedir}/svnjavahl.jar" />
    
        </path>
    
        <typedef resource="org/tigris/subversion/svnant/svnantlib.xml" classpathref="path.svnant" />
        <target name="main">
            <svn>
                <checkout url="svn://xxx" destPath="X:/XXX" revision="HEAD" />
            </svn>
        </target>
    </project>
    

    感谢您的帮助。

    【讨论】:

      【解决方案3】:

      有同样的问题。将“资源”的值从“org/tigris/subversion/svnant/svnantlib.xml”替换为“svntask.properties”为我做了。

      示例如下:(svn_1.0.0; eclipse juno)

      <taskdef resource="net/sf/antcontrib/antlib.xml">
      <classpath>
        <pathelement location="D:/.../ant-contrib-1.0b3.jar"/>
      </classpath>
      </taskdef>      
      <path id="path.svnant">
          <pathelement location="D:/.../lib/svnant.jar" />
          <pathelement location="D:/.../lib/svnClientAdapter.jar" />
          <pathelement location="D:/.../lib/svnjavahl.jar" />
      
      </path>
      
      <typedef **resource="svntask.properties"** classpathref="path.svnant"/>
      
      <target name="ifAvailable">
          <available classpathref="path.svnant" **resource="svntask.properties"** 
          property="temp"/>
              <echo message="SVNAnt is available = ${temp}"></echo>   
      </target>
      

      输出>>>>>

      Buildfile: D:\...\build.xml
      

      如果可用: [echo] SVNAnt 可用 = true 构建成功 总时间:306毫秒

      【讨论】:

        【解决方案4】:

        替换

         <taskdef resource="org/tigris/subversion/svnant/svnantlib.xml" />
        

         <taskdef resource="svntask.properties"/>
        

        svntask.properties 存在于 svnant.jar 中

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 2013-03-15
          • 1970-01-01
          • 2021-07-23
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2012-09-13
          • 1970-01-01
          相关资源
          最近更新 更多