checkout using JavaAPI
From: aman mahajan <er_aman_at_rediffmail.com>
Date: 2005-12-28 04:49:59 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
Aman Mahajan
|
This is an archived mail posted to the Subversion Users mailing list.
This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.