[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Regarding svnant checkout using JavaAPI

From: aman mahajan <aman_mahajan2001_at_yahoo.com>
Date: 2005-12-27 14:09:13 CET

Hi,

I am creating a small front end for my project which
will be having 1-2 customized build related tasks.

I am using Java APIs of ant to implement that.
As our repository is SVN so I am using svnant for some
svn tasks.

But it is throwing null pointer exception when try to
execute tasdef.
Please let me know where i m wrong

the code is as follows

=====================
/*
* testAnt.java
*
* Created on December 27, 2005, 11:53 AM
*/
import java.io.File;
import java.net.MalformedURLException;

import org.apache.tools.ant.*;
import org.apache.tools.ant.taskdefs.Mkdir;
import org.apache.tools.ant.taskdefs.Taskdef;
import org.apache.tools.ant.types.FileSet;
import org.apache.tools.ant.types.Path;
import org.tigris.subversion.svnant.*;
import org.tigris.subversion.svnclientadapter.SVNUrl;
//import
org.tigris.subversion.svnclientadapter.javasvn.commands.CheckoutCommand;
/**
*
* @author aman_m`ahajan
*/
public class testANt {

/** Creates a new instance of testAnt */
public static void main(String arg[]){
Project project = new Project();
try {
project.init();
} catch (BuildException e) {
e.printStackTrace();
}
File f = new File("C:\\antAman");

//Creates the new target
//Target copyFile = new Target();
Target checkout = new Target();

//Sets the name of target
//copyFile.setName("copyFile");
checkout.setName("checkout");

//Adds the target to the project
//project.addTarget(copyFile);
project.addTarget(checkout);

//Mkdir is subclass of task class (This portion is
ther
// to define the tasks and set the values accordingly
/*Mkdir makedir = new Mkdir();*/
Taskdef td = new Taskdef();
//td.setName("useSvn");
td.setResource("org.tigris.subversion.svnant.SvnTask");
//td.setClassname("org.tigris.subversion.svnant.SvnTask");

Checkout co = new Checkout();
//Sets teh task name
//makedir.setTaskName("makedir");

//As this task is related to creation of dir so setDir
is required
//makedir.setDir(f);
//sets the project in target.
//makedir.setProject(project);

co.setProject(project);
SVNUrl urlS = null;
try {
urlS = new
SVNUrl("http://x5.com/repo/branches/B2006_1_1/equicom-admin-common-web");
} catch (MalformedURLException e1) {
e1.printStackTrace();
}
co.setUrl(urlS);
co.setDestpath(f);
//co.execute()

td.setProject(project);

td.setClasspath(pth);
td.execute();

//Add the task to target specified
//copyFile.addTask(makedir);
//checkout.addTask(co);

//execute the target
//copyFile.execute();

}
}
====================

Actually there is no Javadocs for svnant so bit
difficult to code too.

Please help me to get rid of this problem so that i
can check out the code.

~Aman

                
__________________________________________
Yahoo! DSL – Something to write home about.
Just $16.99/mo. or less.
dsl.yahoo.com
Received on Wed Dec 28 00:09:13 2005

This is an archived mail posted to the Subclipse Dev mailing list.