• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Difference between Dependency and Assembly plugins?

 
Ranch Hand
Posts: 87
Mac Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Saloon Keeper
Posts: 27763
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Iarla O'Riada
Ranch Hand
Posts: 87
Mac Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 27763
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 27763
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 87
Mac Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Tim. The terminology was throwing me a bit but I have a clearer picture now.

Best,
Iarla
 
reply
    Bookmark Topic Watch Topic
  • New Topic