aspose file tools*
The moose likes Ant, Maven and Other Build Tools and the fly likes Difference between Dependency and Assembly plugins? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "Difference between Dependency and Assembly plugins?" Watch "Difference between Dependency and Assembly plugins?" New topic
Author

Difference between Dependency and Assembly plugins?

Iarla O'Riada
Ranch Hand

Joined: Oct 06, 2012
Posts: 84

Given that the dependency plugin can calculate dependencies, rename them and copy them to a location - why is the assembly plugin necessary? I find the Maven docs dense and I don't really interact with it much unless I'm running a build which is just a right-click in Eclipse.
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16070
    
  21

The dependencies specify what versions of what resources need to be fetched from the repositories and used in the assembly process.

The assembly goal is just one possible goal. For quick test builds, I commonly do a "mvn clean compile war:war" build. For constructing deployable units, I use "mvn package".

Both of those goal sets require dependency resolution, so limiting the dependency resolution to only the "assembly" goal would be counter-productive.


Customer surveys are for companies who didn't pay proper attention to begin with.
Iarla O'Riada
Ranch Hand

Joined: Oct 06, 2012
Posts: 84

But the assembly is actually a plugin rather than a goal, right? From http://maven.apache.org/plugins/maven-assembly-plugin/ : "The Assembly Plugin for Maven is primarily intended to allow users to aggregate the project output along with its dependencies, modules, site documentation, and other files into a single distributable archive."
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16070
    
  21

Assembly is a plugin that provides a goal. "Plugin" is a bit of a misnomer sometimes. Eclipse, for example, is virtually nothing but plugins, but we tend to think of it as a unified whole. The Tomcat webapp server is pretty much the same thing, only less likely to see mods to the core plugin set.

One of the things I dislike about Maven is that it's "magic". That is, unlike Ant, where you can plainly see a process flow, in Maven, you specify a goal and Maven handles everything automatically, and more or less invisibly. So, for example, the Assembly plugin internally triggers the Dependency plugin as a pre-requisite step in the process.

This isn't always automatic, however. The reason why I have to say "mvn compile war:war" is that the war:war goal does not automatically invoke the compile goal and I have to do it manually. I'd be less happy about that except that a "mvn war:exploded" goal also won't invoke compile and that means that an on-the-fly reassembly of a webapp being debugged won't automatically replace all of the running classes (which usually ends up badly).

Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16070
    
  21

Incidentally, I just looked at the Dependency plugin, and it appears to be mostly for detailed dependency analysis and control. Actual dependency resolution - as far as I can tell - is part of the Maven core. Or at least, it doesn't show up as a visible sub-goal when I do a build. It may be a sub-function in the resources plugin, although the docs don't say so.
Iarla O'Riada
Ranch Hand

Joined: Oct 06, 2012
Posts: 84

Thanks Tim. The terminology was throwing me a bit but I have a clearer picture now.

Best,
Iarla
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Difference between Dependency and Assembly plugins?