I need to commit a file into CVS repository using java code.
My requirement is, When a submit button is clicked, I need to receive the call to java method and then commit a file to CVS repository using Java code in the background without using any GUI tools.
I know the below items.
How can I use the above details to connect to CVS server and then do the commit?
Please find below the solution which worked for me. Its pretty straightforward and easy.
ProcessBuilder builder = new ProcessBuilder(
"cmd.exe", "/c", "cd D:/CVS_REPO/ && dir && cvs checkout && cd project_folder && cvs commit -m \"Admin Tool\"");
builder.redirectErrorStream(true);
Process p = builder.start();
BufferedReader r = new BufferedReader(new InputStreamReader(p.getInputStream()));
String line;
while (true) {
line = r.readLine();
if (line == null) { break; }
System.out.println(line);
}