Turn an command-line application into a JAR
|August 6, 2014||Posted by forumadmin under TechQns||
I’m facing a quite annoying problem. I have a command-line application which of I don’t have the source code. I’d like to be able to use this application from a Maven plugin I’ll write, which is not a problem if the application is installed on the machine and present in the path (basically, it is a classic Java process).
Problem is : I’d like the usage of this application to be transparent for the user so he just have to refer the plugin I wrote in the parent POM and that plugin download the programm to use it.
The easiest way to achieve that is to make the programm a maven dependency of the plugin I’ll wirte. So, I was wondering if it was possible to turn the command-line programm into a maven plugin, basically by writing a MOJO which manipulates the command-line programm, which is place in the resources files and refered in the classpath.
Would the Jar compression interfere with the classic usage of the command-line programm through a Java process object ?
Edit : Let’s say I’ve for instance a project like this :
and, in wrapper.java I make a call to the executable :
ProcessBuilder pb = new ProcessBuilder("cmd-line-executable", "arg1", "arg2"); pb.start();
and all of this is packaged in a .jar. would the call work ?
|Asked By – Augier||Read Answers|