Export - runnable jar file - and copy all required libs in subfolder next to generated JAR

Answered

Hi
Eclipse has the option to "Copy required libraries into a sub-folder next to the generated JAR",how can this be done in Intellij?
I can add the JAR artifact "From the module with depenencies", bit i can not get it to work.
I've also tried adding the lib dir as a module in the Project Structure menu without success.

Thanks

4 comments
Comment actions Permalink

Please clarify why "From the module with depenencies" didn't work for you, attach a sample project to reproduce it.

0
Comment actions Permalink

here goes..
basically i want to run it like this:
java -jar Server.jar

The Server.jar must be very small and all the libs/dependencies required for cxf to work must live in: . /cxf_libs

Thanks
Neels



Attachment(s):
Server.zip
0
Comment actions Permalink

Try this sample project: ftp://ftp.intellij.net/pub/.idea/cxf_server.zip .

Note that IDEA can't move jars to a subdirectory when creating a jar artifact with dependencies. You have to manually move the files there in the artifact configuration and also adjust the classpath in the maifest file by addig cxf_libs/ to the jar names.

It might be easier to set up an automated Ant or Maven task to build the jars from your project so that it automatically generates manifest file with the correct paths and packages the jars.

0
Comment actions Permalink

Got it, Thanks for your help.
Regards

0

Please sign in to leave a comment.