This week's giveaway is in the EJB and other Java EE Technologies forum. We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line! See this thread for details.
I have a simple class file with a main method. I would like to now create a jar file using Maven which also has all the jar's that it uses. I have even set up the Maven project and when I actually built it, it creates a jar file but I do not find any referenced libraries as part of that jar. How to acheive this?
Even if the jar contained the other jars it's still not going to work like you think it will; you'd either need to include all the classes from the dependencies in the jar (i.e., unzip then add to the distribution jar's class directory hierarchy) or create a zip file distro which can be unzipped and run with the appropriate classpath set.
David Newton wrote:Why do you want a jar that contains other jars?
Maybe to make an executable jar that depends on library jars without having to explode them and merge them into the main jar classes?
There is, BTW a Maven plug-in to do exactly that. It's called something original like "Maven Executable JAR plugin" and its targets include both a jar that can be executed via the "java -jar" command and a more traditional JAR that can be included in a classpath.
Customer surveys are for companies who didn't pay proper attention to begin with.