Reputation: 21200
I knew mvn:package
can be used to generate JAR or WAR, is there any difference between mvn:assembly
?
Upvotes: 7
Views: 2797
Reputation: 2387
Assembly is needed if you plan to create an archive that contains your classes plus the libraries + docs + ...
To create war (or any native Maven packaging) you can simply set <packaging>war</packaging>
.
If you want to customize this war, you need the war (respectivelly jar) plugin.
Upvotes: 0
Reputation: 22052
They are quite different. 'package' is a simple command used for simple/single projects where you only have to create a jar/war.
The assembly plugin is much more powerful, and can be used to create full distribution packages for large projects. This can be just a simple jar file, but it can also be a large distribution archive for your project, including source code, documentation, etc. You configure what the assembly should look like by means of an XML file called the assembly descriptor.
Upvotes: 6