saravanan.P
saravanan.P

Reputation: 73

How to access files in SVN using java

I need help from you, i want open a file from SVN using java code, can any one tell me the flow of accessing the files, or can any one send me sample code for that one.

Can any one send me example code for accessing svn through HTML using java.

Upvotes: 7

Views: 16146

Answers (4)

CharlieMisner
CharlieMisner

Reputation: 21

If you are doing this at work, and are not working on an open source project, I would stray away from SVNKit. They call themselves open source, but will charge you if you use SVNKit for commercial purposes.

Another good option is Apache Maven SCM(Source Code Manager). The docs are a little spotty, but it is truly open source. Here's a link to their page with some SVN examples.

Upvotes: 0

A simple way could be to run an svn command from Java. For instance you could run the command

 svn cat yourfile.txt > /tmp/yourtemporaryplace.txt

then have Java read the /tmp/yourtemporaryplace.txt. Even better, read from the process running svn cat yourfile.txt like in this question on java popen

You could also use a SVN client java library like svnkit

(PS I don't code in Java usually, just googled for you)

Upvotes: 1

Matthew Farwell
Matthew Farwell

Reputation: 61705

You need to look at SVNKIT, Subversion for Java. From there:

It supports

  • Repository access over http(s), svn, svn(+ssh) and file protocols.
  • Working copy operations - all are supported.
  • Repository administration: create, load, dump and replay operations.
  • Additionally to its own API, SVNKit implements JavaHL API.
  • SVNKit is reported to work on Windows, OSX, Linux, BSD and OpenVMS.
  • SVNKit does not require native binaries, it works out of the box.
  • Native Subversion configuration files are used by default.
  • Java Subversion command line client is part of SVNKit.
  • Latest SVNKit supports Subversion 1.6.5.

Upvotes: 6

Upul Bandara
Upul Bandara

Reputation: 5958

Though I have not use for my projects, It seems like following library is worth to look at. http://svnkit.com/

Upvotes: 1

Related Questions