Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Calling SVN commands from a java program

I want to call SVN commands (update , commit) from a java program. any help ?

SVN : Tortoise SVN Environment : java program will be running inside a jBoss server.

like image 840
Anandhakrishnan Avatar asked Apr 26 '12 13:04

Anandhakrishnan


People also ask

How do I access TortoiseSVN from command line?

Locate TortoiseSVN and click on it. Select "Change" from the options available. Refer to this image for further steps. After completion of the command line client tools, open a command prompt and type svn help to check the successful install.

Which command is used to check in the changes into repository in svn?

The svn log command is used to display all the commits made on the repository or file. The svn log command is executed as follows: svn log Path.

Which command is used to retrieve all the changes from the svn repository but without applying them to your local branch?

The svn shelve command stores your changes without submitting them.


3 Answers

It's a really, really bad idea to use a GUI SVN client from within an app server. While TortoiseSVN can be scripted, it's still a GUI application, and an unexpected situation can cause it to pop up a dialog on your server (and some tasks may always open a dialog).

It,s much, much better ot use a Java implementation of SVN, such as SvnKit - then you can work with a nice Java API and your question becomes moot.

like image 138
Michael Borgwardt Avatar answered Oct 14 '22 13:10

Michael Borgwardt


Sure, there are several libraries out there that do the job. Personally, I'd either go with SVNKit or with the Maven SCM abstraction (the latter is less powerful but more portable).

like image 36
Sean Patrick Floyd Avatar answered Oct 14 '22 14:10

Sean Patrick Floyd


It's probably simplest to use SVNKit which is a native implementation of SVN in Java, provided you can get the version to match your command-line client version if you need to share working copies between them.

It's under a copy-left-ish licence, but as long as you're running the code on your own server and not distributing it that should be OK (but IANAL, etc.)

like image 4
Rup Avatar answered Oct 14 '22 14:10

Rup