aspose file tools*
The moose likes Ant, Maven and Other Build Tools and the fly likes check out from svn using ant Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "check out from svn using ant" Watch "check out from svn using ant" New topic
Author

check out from svn using ant

marten kay
Ranch Hand

Joined: Feb 03, 2007
Posts: 178

Hi

I have just starting to explore ant to automate my build.

In my mind, the first thing to do for a build is to checkout the latest source version from the repository (svn in my case). However I have found the documentation scant on this.

I have been able to get the ant executable below to work, however the web advice from which this is derived said that executables are best avoided.

So my questions are
1) is it normal to commence a build by checking the source out of the repository?
2) if so, is there a better way then using an ant executable?


Thanks

Marten




when in doubt put it in parenthesis and stick a dollar sign in front of it, only good can come from this.
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30526
    
150

Yes, it is normal to start a build by checking out the code from the repository.

You are using the SVN executable in your example (not the Ant executable) via Ant's exec task. That's one way of doing it. The other way is to use the SVN Ant task. I used the command line SVN in my Ant builds - that approach is certainly viable.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5827
    
    7

The other possibility is using a continuous integration tool, such as Jenkins, to check out the sources from Subversion and it starts Ant to do the build. Besides, isn't the Ant script in the project's base directory and thus to get the script you have to first check out the project?


JBoss In Action
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30526
    
150

Peter Johnson wrote:Besides, isn't the Ant script in the project's base directory and thus to get the script you have to first check out the project?

For me, it wasn't. We had a generic script that got passed the the projects that it needed to pull. Even if the project is checked out, it might not be the latest copy.
marten kay
Ranch Hand

Joined: Feb 03, 2007
Posts: 178

Thanks Jeanne, Thanks Peter

So, I have
1) checked my version of svn as 1.8.0
2) downloaded SvnAnt 1.3.x which is bound against subversion 1.6.x, but there is no 1.8.x available
3) unzipped svnant-1.3.1.zip into my ant/lib folder
4) put the following in my build file


5) and get the following message:
BUILD FAILED
C:\Users\USER\Desktop\antrproject\build.xml:12: 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.


Any clues? I find this all a little bit secret java business.

Thanks

Marten

PS also tried adding to the build.xml the following line, but not sure what it means and it doesn't work



I have my svn ant in "C:\ant\apache-ant-1.9.3-bin\apache-ant-1.9.3\lib\svnant.jar" ... to which I changed my classpathref but it still doesn't work
marten kay
Ranch Hand

Joined: Feb 03, 2007
Posts: 178

So I finally got it to work, although it doesn't seem very best practice



The respponse is
marten kay
Ranch Hand

Joined: Feb 03, 2007
Posts: 178

For information - this does it



Thanks again
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: check out from svn using ant