Having written a command-line program in Java, using Maven as the build system, what's the recommended way to go from there to having the program available as a command?
Suppose the program is called Foo. In the foo
directory I can run mvn package
to generate target/foo-1.0-SNAPSHOT.jar
, which can in turn be run with java -cp target/foo-1.0-SNAPSHOT.jar foo.Main %*
but that command is too long to expect users to type. I need to get to the point where typing foo
on the command line will run the program. mvn install
doesn't; it just copies the jar to the local maven repository.
What's the recommended way to make a program available as a command?