On Wed, Jun 30, 2010 at 7:40 AM, Antonio Petrelli <[email protected]> wrote: > 2010/6/30 Nathan Bubna <[email protected]>: >> So, if i wanted to use the servlet log, i would have to download and >> use both a velocity-engine jar and a velocity-engine-servlet jar? > > Yes. Or declare a dependency to velocity-log-servlet (I would like to > name it this way) and velocity-engine will come as a transitive > dependency.
we have plenty of non-Maven users. so, naming it that way is making an assumption that i would not recommend making. > Otherwise, if you want a single package, we can prepare an uberjar > using the Shade plugin, for Ant fanatics :-D > To see the power of transitive dependencies, I suggest to download > m2eclipse (the plugin inside Eclipse for Maven support) that has a pom > editor, containing a graph of dependencies. It's nice to see how your > project is built on various other frameworks. > >> is it worth that complexity just to have a "clear" >> dependency hierarchy? > > Absolutely yes, optional dependencies are far more confusing than small > modules. > Take a look at how Tiles 2.2.2 is now, little modules with few > classes, like tiles-servlet-wildcard, just to be sure to include > Spring only when needed. more confusing to Maven users, perhaps. but there are many who do not use Maven, for whom i think the confusion would run the other way. >> optional packages? so *can* Maven acknowledge that a dependency is >> required for compilation but optional at runtime? i've been operating >> under the (mis)conception that it could not. > > Yes it can, by adding <optional>true</optional>. > It must not confused with <scope>provided</scope> that means that a > package is needed when compiling, but it is "provided" by an external > source, e.g. servlet.jar in a servlet container, so it must be > present, but outside of the package itself. > The "provided" scope is clearer with WARs: if the scope is "compile" > or "runtime", the package is included in WEB-INF/lib, if it is > provided, it is not (not sure about optional packages though). yeah, i knew about "provided", but that would probably only apply to the servlet api dependency. it would not have been an appropriate designation for our log4j dependency. it is the "optional" designation that i was looking for. >> what sort of transitive dependency troubles does it cause? > > If your project has optional packages, they must be included > explicitly in projects that depend on it if you want to use them. The > same for "provided" packages. that sounds perfect. how is it a trouble to require that users explicitly declare optional things they wish to use? extra feature -> small extra effort. that is no different than non-Maven users being required to add a jar for optional things they wish to use. i don't see the down side here. i very much like the sound of this "optional" setting. > If you have a module with no optional packages you are declaring that > your module can work *if and only if* all those packages are present; > Maven recognizes this situations and uses all transitive dependencies > for compiling and the rest (depending on the scope). > > Antonio > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
