Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

check out from svn using ant

 
marten kay
Ranch Hand
Posts: 178
Java jQuery Postgres Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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


 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34095
337
Eclipse IDE Java VI Editor
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Peter Johnson
author
Bartender
Posts: 5852
7
Android Eclipse IDE Ubuntu
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34095
337
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 178
Java jQuery Postgres Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 178
Java jQuery Postgres Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So I finally got it to work, although it doesn't seem very best practice



The respponse is
 
marten kay
Ranch Hand
Posts: 178
Java jQuery Postgres Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For information - this does it



Thanks again
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic