I'm just starting to use Maven (really appreciating it), and I need to be able to quickly generate the <href = "http://en.wikipedia.org/wiki/JAR_file" rel = "noreferrer"> JAR file for my application and a directory with all the dependencies (e.g. lib) so that I can deploy these two, which will run autonomously. Generating a JAR file with the appropriate manifest is simple, but I donโt know how to get Maven to copy the dependencies for the current project into the lib directory that I can deploy.
Since this is for standalone Java applications, I'm not interested in deploying to the Maven repository, which is also pretty trivial or at least easy googleable.
I figured out how to do everything except copy the dependent JAR files to some specified directory. This is the workflow I'm looking for:
$ mvn clean $ mvn package $ cp -r target/{lib,myApp.jar} installLocation
Then running myApp.jar from installLocation as a JAR file should "work" regardless of my $CLASSPATH .
To try to preempt some answers:
- I have Main-class: set and it works great.
- I also set the classpath to MANIFEST.MF, and that works fine too.
- I figured out how to use
<classpathPrefix> and <classpathMavenRepositoryLayout> to do this work, but only on my machine. (via: <classpathPrefix>${settings.localRepository}</classpathPrefix> )
java maven-2 deployment desktop-application
rcreswick Feb 20 '09 at 1:50 2009-02-20 01:50
source share