I met with a group of maven users from several business units of my
company last week. The single largest pain point is still with regard to
dependency management. Despite the changes Patrick and I introduced in
MNG-1577 they are still having difficulties primarily because it is
impractical or impossible to use other projects POMs via inheritance.
During our discussions several mechanisms were proposed but in the end
none of them worked properly.
In the midst of the discussion it occurred to me that this was easily
solvable with a few lines of code. I've implemented something that works
over the weekend but before I commit it I'd like to get some feedback,
especially as this would be my first direct commit into maven.
To illustrate this I created a sample test project that had three child
projects; first, second and third. "first" has a dependencyManagement
declared with a few dependencies in it. "second" has a
dependencyManagement with "first"'s pom declared as dependency.
Likewise, third also has a depdendencyManagement with "second"'s pom
declared as a dependency. "second" and "third" each have a versionless
dependency that is declared in one of the other pom's
dependencyManagement sections.
With maven 2.0.7 this fails as the dependency versions never get
resolved since each project only contains the version of the referenced
pom, not its managed depenendies. With my patched version the dependency
on the pom is removed and is replaced with the managed dependencies of
the referenced pom. This caused the build to complete successfully. Of
course, in the test project I could have specified more than one pom in
the dependencyManagement section and had them merge together.
Normally, I'd wonder why someone had specified a dependency in
dependencyManagement with a type of pom as I can't think of a good use
for it. However, since I don't want any risk of breaking any existing
projects I also made a change to require that the dependency in
dependencyManagement specify a new scope, "import", along with the type
of "pom". This eliminates any possible problems but it does introduce a
new scope which is only used for this purpose. I could have required a
property to control this behavior, but I prefer using the scope as it
can control the handling of each dependency.
Hopefully this explanation is clear enough. Please let me know what you
think.
Ralph
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]