Using SVNAnt in eclipse Build Failed (Could not load definitions from resource)

12,744

Solution 1

It finaly work using SvnAnt 1.3.1.

The checkout work fine using this code :

<?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>

Thanks for help.

Solution 2

You have to use

<taskdef />

instead of <typedef/>

Everything else looks fine.

Solution 3

had the same problem.. replacing the value of "resource" from "org/tigris/subversion/svnant/svnantlib.xml" TO "svntask.properties" did it for me.

sample below: (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>

OUTPUT>>>>>

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

ifAvailable: [echo] SVNAnt is available = true BUILD SUCCESSFUL Total time: 306 milliseconds

Share:
12,744
thomaf
Author by

thomaf

Updated on June 04, 2022

Comments

  • thomaf
    thomaf almost 2 years

    I want to use SVNAnt in eclipse. But when I run my script, I have this message :

    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.
    

    Here is the Ant build file :

    <?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>
    

    The JAR files are of course in basedir. I can't find similar problem nor any solutions.