Reputation: 6933
I am thinking of writing a java application to wrap CVS and some of our other custom build/deploy scripts. This way it will be easy to view status, do a build, publish and deploy without having to type in the commands. What is the easiest way to do this?
Offhand I'd guess I have to redirect the output from the command to a String and parse it for the information I want.
Any other techniques/suggestions?
Upvotes: 0
Views: 1267
Reputation: 72019
For parsing command-line arguments, I recommend args4j.
UPDATE: Based on your problem description, it sounds like any or all of the following would be better options than rolling your own: Hudson, Capistrano, Fabric, or just plain-old shell scripting.
UPDATE 2: Based on the downvote and comment, you seem to be interested in interacting with the command line from the other side, i.e., driving the command line, not being driven by the command line. In that case, bitter experience suggests that Java is emphatically not the best choice. Almost any "scripting" language is a better fit. If you still want to do it, there's always ProcessBuilder and friends.
Upvotes: 2
Reputation: 4444
I answered a similar question some days ago:
Implementing the "system" command in Java
Wrapping a command-line call is a bit tricky.
Upvotes: 1