问题
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.
回答1:
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.
回答2:
Though I have not use for my projects, It seems like following library is worth to look at. http://svnkit.com/
回答3:
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)
回答4:
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.
来源:https://stackoverflow.com/questions/8165014/how-to-access-files-in-svn-using-java