I use the assembly plugin and it works really well.

I've just started to learn and use maven with a stand alone application
and so far I'm hooked! 

We have to move the full j2ee app soon, but this is a good starting
point.

Pete

-----Original Message-----
From: Simon Lehmann [mailto:[EMAIL PROTECTED] 
Sent: 25 November 2008 02:29
To: [email protected]
Subject: Running a standalone application built with maven

Hello everyone,

I am currently trying to use maven for building my project. I have read
and followed the documentation found in the Maven Users Centre and it
really works quite well so far.

The problem I have now is, that I don't know how to run my application
once it is built with, say 'mvn package'. I tried 'java -jar
target/myproject.jar' (in the base directory of the project), but then
it doesn't find the jars it depends on. I have jaudiotagger and
sqlite-jdbc as a dependency, but it only cannot find sqlite-jdbc, which
I only need at runtime (and have specified as such).

After some searching I have found a way to solve the problem of missing
dependencies, by using 'java -cp $CLASSPATH:target/myproject.jar
my.package.MainClass', but then it doesn't find any resources I try to
load in my code with
"this.getClass().getClassLoader().getResource(...)". All resources are
placed in the src/main/resources directory. If I have no dependecies and
thus can run the application with "java -jar target/myproject.jar" it
finds the resources.

Is there some way to simplify this, say, by automatically generating a
startup script which can be used to start the application without having
to worry about all these things?

Thanks a lot,

Simon Lehmann

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to