This week's book giveaway is in the Mac OS forum. We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line! See this thread for details.
Thank you very much for your reply. In my case I really need to use an assembly descriptor because I am adding other files to the final distrubution. From my limited knowledge I see that you can use either
Is that correct? If that is the case, then I really need to find a way to generate the jar from the assembly descriptor. So far, I am getting all the dependencies sent to the final distribution, however, they are not in a jar file as I need them.
One jar file with the application
One jar file with all the dependencies
Some help documents that will be placed under the HelpDocs directory
Some bat/sh files that will be placed under the OtherDocs directory
My idea is to generate the zip with the assembly, as well as the dependencies jar. The app's jar is created in the POM in the following way..
Do you know of a more efficient way to accomplish that?
You need to invoke the assembly plugin twice. For the first invocation, build the JAR containing all of the dependencies. For the second invocation, create the zip file with the contents you listed. You will need two assembly descriptors, one for each invocation.
Why do you want your app to be in one JAR and the dependencies in a separate JAR? Usually I do one of two things:
a) place everything into a single JAR file (and I make it runnable by specifying the main class)
b) Place the app JAR and the JARs for all the dependencies into a lib directory. Then I have my scripts build the classpath and run the app.
I usually prefer option (b), it makes it easier for my customers to see which components I am making use of, and the individual JARs retain their version and build information.
Joined: Oct 13, 2011
Could you please advice on how to do that. I am currently using maven-assembly-plugin. I run it twice, however, the jar with al the dependencies is a big file and by the time when it is finally created the zip file was created already and does not contain the jar. Do you know of any way to stop maven assembly from starting to create the zip until the jar is finished. Here is the portion of my POM that is related to that: