I'm trying to perform SVN copy operation (creating a tag from a branch) using Java.
I'm getting the below exception.
"Exception in thread "main" java.lang.NullPointerException
at org.tigris.subversion.svnant.SvnFacade.getFacade(Unknown Source)
at org.tigris.subversion.svnant.SvnFacade.getSetting(Unknown Source)
at org.tigris.subversion.svnant.SvnFacade.getDateFormatter(Unknown Source)
at org.tigris.subversion.svnant.commands.SvnCommand.getDateFormatter(Unknown Source)
at org.tigris.subversion.svnant.commands.SvnCommand.getRevisionFrom(Unknown Source)
at org.tigris.subversion.svnant.commands.Copy.setRevision(Unknown Source)
at svnOperation.createTags.commitTags(createTags.java:55)
at svnOperation.createTags.main(createTags.java:23)"
I'm using the latest SVN JAR files.
Could someone please suggest how to correct this or what mistake I'm doing here.
Here is my code:
Project p = new Project();
p.setProperty("username", "automation");
p.setProperty("password", "automation");
p.setProperty("javahl", "true");
p.setProperty("javahl", "true");
SvnTask svn = new SvnTask();
Copy C1 = new Copy();
C1.setDescription("Creating tags");
C1.setSrcUrl(new SVNUrl("SrcUrl"));
C1.setDestUrl(new SVNUrl("DestUrl"));
C1.setMessage("message");
C1.setRevision("1234");
C1.setProject(p);
svn.addCopy(C1);
svn.setProject(p);
svn.execute();
SvnAnt is designed to be used from Ant scripts. However, it appears you're trying to interact with Subversion with Java code.
SVNKit is the better way to access Subversion features from within a Java application.
Here is an example of creating a Subversion tag:
See Getting Started With SVNKit for more.