The svnant project provides a set of Ant extensions which can be used to interact with Subversion repositories.
As with most Ant extensions, SvnAnt's task and type names must be mapped to their implementing classes before being used in an Ant build file. An example of how to use the antlib bundled in SvnAnt's JAR file to perform that registration follows:
<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" />
Please be aware that the previously used declaration mechanism using the file
svnant.properties
is no longer supported so it's necessary to update
your declaration if necessary.
The path declaration shown above only contains the necessary jar files used to realise subversion access.
If you don't extend the above mentioned path declaration the only possibility to access
a subversion repository is the so called commandline
binding.
In general you want to extend this path with additional libraries in order to use a specific binding to the subversion repository.
The following list shows the requirements and the meaning of the available bindings (the order specifies the precedence):
This type of binding makes use of a Java native bridge in order to realise the subversion commands. These share libraries must be on your library path. You can launch the Ant script using the following option (of course you need to adjust the path):
-Djava.library.path=${basedir}/javahl
You also need to add the Jar equivalent of the binding which is typically named
svnjavahl.jar
.
If this binding doesn't seem to work, you should check whether the library path is correct or not. You can use the echoproperties to get this information.
The svnkit binding is purely java based. Using this
binding requires the jar svnkit.jar
to be used for the svnant
declaration. You also need the ganymed.jar
which provides the necessary
functionality for SSH based communication.
This binding is the simpliest one and is considered to be a fallback solution. It
just looks for the svn executable itself, so it must be locatable using the
path specified within the propert java.library.path
.
SvnAnt license This license applies to all portions of svnant library, which are not externally-maintained libraries (e.g. svnClientAdapter, JavaHL or SVNKit). Such libraries have their own licenses; we recommend you read them, as their terms may differ from the terms below. /* ==================================================================== * The Apache Software License, Version 1.1 * * Copyright (c) 2000 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. The end-user documentation included with the redistribution, * if any, must include the following acknowledgment: * "This product includes software developed by the * Apache Software Foundation (http://www.apache.org/)." * Alternately, this acknowledgment may appear in the software itself, * if and wherever such third-party acknowledgments normally appear. * * 4. The names "Apache" and "Apache Software Foundation" must * not be used to endorse or promote products derived from this * software without prior written permission. For written * permission, please contact apache@apache.org. * * 5. Products derived from this software may not be called "Apache", * nor may "Apache" appear in their name, without prior written * permission of the Apache Software Foundation. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * ==================================================================== * * This software consists of voluntary contributions made by many * individuals on behalf of the Apache Software Foundation. For more * information on the Apache Software Foundation, please see * <http://www.apache.org/>. * */
* 1.3.1 - Built against svnClientAdapter 0.9.102, Subversion 1.6.x, SVNKit 1.3.x - #1271: made some refactorings so the codebase has been refactored to share resource related functionalities. - #1156: the checkout command now supports the depth parameter which is more accurate than the recursive parameter. - #1035: using the svntask as part of ant's parallel task should work properly now. - #587: it should be possible now to reject suspicious certificates so only trusted ones will be accepted. - #1272: command beginning and endings will be logged as verbose message as their mainly useful for for error scenarios. - #828: 'wcVersion' won't incorporate 'svn:externals' anymore for the version calculation - #906: added 'singleinfo', 'list' commands - #906: added 'svnAvailable' condition - #619, #689: the 'log' command now provides a verbose option for the changed pathes - #815: the commands 'singleinfo' and 'info' are now supporting the property 'repourl' - #916: the 'copy' command now supports the option 'makeParents' to enforce the creation of parental structures - #1092: if 'failonerror' is set to false the 'svn' task will quit normally if there's no client adapter available - #1209: the 'wcVersion' command now adds a '.' to the prefix if it's missing - #1213: added the 'diffSummarize' command - #1079: improved handling of 'wcVersion' for unversioned pathes * 1.3.0 - First version released by Joshua Frankamp * 1.2.1 - Built against svnClientAdapter r4107, Subversion 1.5.x, SVNKit 1.2.x - fixed remote info bug - fixed svnkit exists task - added cleanup task * 1.2-rc1 - Built against svnClientAdapter r3957, Subversion 1.5, SVNKit 1.20 beta4 * 1.1-rc3 - Built against svnClientAdapter r2847, Subversion 1.4.2 and SVNKit 1.1.0 - renamed references to JavaSVN (former name of SVNKit) - renamed the svn task attribute "javasvn" to "svnkit" * 1.1-rc2 - Built against svnClientAdapter r2834 and Subversion 1.4.0, incorporating numerous bug fixes and improvements from both. - Added support for javasvn adapter - Added the "url" option to <propget> command - Added the "lastChangedDateProperty" to <status> command - Added the "dateFormatter" attribute to <svn> task - Added the "failonerror" attribute to <svn> task and svn selectors - Added the <wcVersion> command - Added the <log> command - Added svn related selectors - Added SvnFileSet type - Added the force option to <add> command * 1.0.0
This chapter provides some known issues which might be of interest when you're experiencing weird behaviour:
Basically Ant properties aren't supposed to be changed. This means that their value stays the same once they have been set. svnant doesn't take care of this so if you're reusing property names you should be aware that they can be overwritten.
We won't change that behaviour since this is a historical result and modifying the behaviour might cause issues on current build scripts.
propset
fails with binary codeIf you're trying to use the propset
command with the file
attribute you might experience errors in case of binary data. This is an error within
the JavaHL implementation and has been filed using the following issue: