Reputation: 3199
I want to use SvnAnt to checkout the latest code from our svn repository, build and then deploy it. I have done all the other parts and only the checking out part is left.I am using svnant 1.2.1 . But in svnant.jar , i only found the *.xml file. Here is what I did for the same :
<?xml version="1.0"?>
<project name="Update" basedir="." default="update">
<!-- all properties are in build.properties -->
<property file="build.properties" />
<path id="project.classpath">
<pathelement location="${svnjavahl.jar}" />
<pathelement location="${svnant.jar}" />
<pathelement location="${svnClientAdapter.jar}" />
</path>
<property name="project.svn.url" value="projectURL" />
<typedef resource="org/tigris/subversion/svnant/svnantlib.xml" classpathref="project.classpath"/>
<target name="update">
<svn>
<checkout url="${project.svn.url}" revision="HEAD" destPath="." />
</svn>
</target>
</project>
However, when running it,it gives the following :
crazyabtliv@linux-hknk:~> ant -v -f svn.xml
Apache Ant(TM) version 1.8.2 compiled on December 20 2010
Buildfile: /home/crazyabtliv/svn.xml
Detected Java version: 1.6 in: /usr/java/jdk1.6.0_26/jre
Detected OS: Linux
parsing buildfile /home/crazyabtliv/svn.xml with URI = file:/home/crazyabtliv/svn.xml
Project base dir set to: /home/crazyabtliv
parsing buildfile jar:file:/home/crazyabtliv/apache-ant-1.8.2/lib/ant.jar!/org/apache/tools/ant/antlib.xml with URI = jar:file:/home/crazyabtliv/apache-ant-1.8.2/lib/ant.jar!/org/apache/tools/ant/antlib.xml from a zip file
[property] Loading /home/crazyabtliv/build.properties
[typedef] Could not load definitions from resource org/tigris/subversion/svnant/svnantlib.xml. It could not be found.
Build sequence for target(s) `update' is [update]
Complete build sequence is [update, ]
update:
BUILD FAILED
/home/crazyabtliv/svn.xml:16: 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.
at org.apache.tools.ant.UnknownElement.getNotFoundException(UnknownElement.java:487)
at org.apache.tools.ant.UnknownElement.makeObject(UnknownElement.java:419)
at org.apache.tools.ant.UnknownElement.maybeConfigure(UnknownElement.java:163)
at org.apache.tools.ant.Task.perform(Task.java:347)
at org.apache.tools.ant.Target.execute(Target.java:390)
at org.apache.tools.ant.Target.performTasks(Target.java:411)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1399)
at org.apache.tools.ant.Project.executeTarget(Project.java:1368)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:1251)
at org.apache.tools.ant.Main.runBuild(Main.java:809)
at org.apache.tools.ant.Main.startAnt(Main.java:217)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109)
Total time: 0 seconds
crazyabtliv@linux-hknk:~>
What is the issue ? Are there any other jar files that have to be added ? Something else to be done ? Thanks I also tried keeping the jar files in ant/lib, but, that gave the same error
Upvotes: 0
Views: 1877
Reputation: 18704
If you are using svnant 1.1 or higher you need to have the taskdef like this:
<typedef resource="org/tigris/subversion/svnant/svnantlib.xml" classpathref="project.classpath" />
The method:
<taskdef resource="svntask.properties" classpathref="project.classpath"/>
is for the svnant 1.0 version.
You can check this easily, by opening the svnant*.jar file and look if there is
Depending on the result you have to use the first or second approach.
Another alternative is specifying the relevant class:
<taskdef name="svn"
className="org.tigris.subversion.svnant.SvnTask"
classpathref="project.classpath"/>
Upvotes: 2