Saturday, August 4, 2007

Setting up SvnAnt 1.0.0 with Eclipse

Getting SvnAnt to work wasn't the easiest of things, but I finally got it working. I have not really done much with Ant in the past, so most Ant related things are new to me. To get SvnAnt to work with the Eclipse IDE, I did the following:
  1. Download SnvAnt here.
  2. Take the files svnant.jar, svnclientAdapter.jar, svnjavahl.jar and place them in your Ant home folder. For example on my windows machine running XP, I placed them in the folder "C:\Program Files\eclipse\plugins\org.apache.ant_1.6.5\lib".
  3. One thing that the documentation does not tell you is that in order to use the example Ant script that comes with the SvnAnt zip file, is that you have to make sure you set your Ant home location in Eclipse. Lets do that now. Open up Eclipse. Goto -> Window -> Preferences -> Ant -> Runtime and click the "Ant Home" button. On my XP machine, I pointed it to "C:\Program Files\eclipse\plugins\org.apache.ant_1.6.5". After setting it you might or might not get a No tools.jar pop up. Just click "Yes" and continue.
  4. Now we need to modify the class path on your machine. Go to the "My Computer" icon on your desktop and right click, then choose properties. Click the Advanced tab. Click the "Environment Variables" button. Under System variables, edit the Variable "CLASSPATH". Add your ants home lib directory to the path. For my machine I added "C:\Program Files\eclipse\plugins\org.apache.ant_1.6.5\lib". You might have to restart your machine in order for the changes to occur.
  5. Now lets test out the the sample ant scripts that comes with the SvnAnt zip file. Copy the build.XML and build. properties files over to your Eclipse project. Run the build.XML file in Eclipse using the Ant window. Refresh your project and you should see a new directory "src_1.0.0" in your project.
That's it. Take a look at the build.XML and for more Ant inspiration.

1 comment: