• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Jeanne Boyarsky
  • Tim Cooke
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Mikalai Zaikin
  • Carey Brown
Bartenders:

Error - "Cannot use javahl nor command line svn client" with subversion

 
Ranch Hand
Posts: 485
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,
I am new to SubVersion.
And i found out that svn is a ant task to interact with the subversion from build file.

when i tried with using svn i am getting the following error
Cannot use javahl nor command line svn client.

Below is my ant tasks


Operating Sys: windows XP.
Ant version: 1.6.5

Can any anyone help me where's the problem is.
[ February 21, 2007: Message edited by: Parameswaran Thangavel ]
 
Bartender
Posts: 2661
19
Netbeans IDE C++ Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This tread handles the same issue.

Regards, Jan
 
Greenhorn
Posts: 1
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Subversion is a full-fledged version control software obviously supporting commands like checkout, add or commit. The ant task from O�Reily didn�t even support checkout! It supported a very limited set from the available commands.
So I went for svnant task which had much better support. Also this way you don�t have to mess with exec�ing the Subversion CLI commands directly from your ant script. It is wrapped up for ease of use. It can also use JNI interface for speed.

To provide access to the Subversion API, svnant uses either the javahl - Subversion Java bindings or Subversion�s command line programs (which must be installed and in your PATH).

javahl uses JNI which must be setup appropriately. I preferred using the Subversion�s command line programs as subversion was already installed in my system.

Steps:
1. I am assuming you already have ant installed. If not do it first. Ensure %ANT_HOME% ($ANT_HOME for *nix) is defined and %ANT_HOME%\bin is appended to your %PATH%.

2. If you do not have subversion installed then first download it and install.

2.1 Ensure that svn is in your path by invoking svn from a command windows (cmd for windows, bash etc. for *nix).

3. Download svnant and extract the files to any directory.

4. Go to your project directory. If it doesn�t have a lib (or equivalent) directory to store required jar files then create one and copy all the files (*.jar ) from svnant�s lib directory:
commons-lang-2.0.jar
jakarta-regexp-1.3.jar
svnClientAdapter.jar
svnant.jar
svnjavahl.jar
svnkit.jar

5. To use svn task you have to add a taskdef to your build file. Use either of the following:
Option 1:
<taskdef name="svn" classname="org.tigris.subversion.svnant.SvnTask"/>
This requires the lib directory to be included with either �ant -lib lib� or by adding an extra parameter:
<taskdef name="svn" classname="org.tigris.subversion.svnant.SvnTask" classpathref="project.classpath"/>

where project.classpath is previously defined as:

<path id="project.classpath">
<fileset dir="lib">
<include name="**/*.jar"/>
</fileset>
</path>
Option 2 is simpler:
<taskdef resource="svntask.properties" classpathref="project.classpath"/>
The project.classpath is previously defined as shown before.

For example you can use this simple build.xml file to fetch latest code from WordPress repository:

<project name="WordPress" default="update" basedir=".">
<path id="project.classpath">
<fileset dir="lib">
<include name="**/*.jar"/>
</fileset>
</path>
<taskdef resource="svntask.properties" classpathref="project.classpath"/>
<target name="update" description="Update WordPress from Subversion Repository" >
<svn>
<checkout url="http://svn.automattic.com/wordpress/trunk/" destPath="src" />
</svn>
</target>
</project>
Run this script by simply typing ant.
 
Ranch Hand
Posts: 318
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
notice here that svnkit is pure java, so if you dont have native svn client installed but have a bunch of jars, ant should still work

I only had issues such as svn client using cached user password, where as svnkit would require username and password properties set

e.g. include these jars

svnClientAdapter.jar
svnjavahl.jar
svnkit-javahl.jar
svnkit.jar

and use

 
Do the next thing next. That’s a pretty good rule. Read the tiny ad, that’s a pretty good rule, too.
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic