Am 28.10.2011 23:04, schrieb KARR, DAVID:
>> -----Original Message-----
>> From: Ansgar Konermann [mailto:[email protected]]
>> Sent: Friday, October 28, 2011 12:15 PM
>> To: Maven Users List
>> Subject: Re: Does the "versions" plugin deal with transitive references
>> to two different versions of an artifact?
>>
>> Am 28.10.2011 20:07 schrieb "KARR, DAVID" <[email protected]>:
>>> If I have a build with a lot of modules, and I end up with two
>> transitive
>> dependency references to "commons-lang", one for version 2.2, and one
>> for
>> version 2.4, does the "versions" plugin let me define rules that will
>> let me
>> choose either the older or newer version to actually use?
>>
>> The versions plugin deals with direct dependencies, not transitive
>> ones.
>>
>>> From the documentation, I would think that "versions:use-latest-
>> versions"
>> comes close, but the documentation is vague.  It just says "Replaces
>> any
>> version with the latest version."
>>
>> Yes, but only those which are defined in the pom of your project, not
>> inside
>> the poms of dependencies referenced by your project.
>>
>> It just updates the text of the pom file, which cannot be done easily
>> with
>> released poms from some maven repository. After all, that's why we have
>> releases first hand: to count on the released artifacts as
>> unmodifiable.
>>
>> To manage transitive dependencies, enable dependency convergence using
>> maven-enforcer-plugin. You will be notified about version clashes
>> between
>> different versions of the same transitive dependency. To remove these
>> clashes, define <exclusions> for those transitive dependencies you
>> don't
>> want in your classpath.

Hi David,

> Can you elaborate on this, please?

Sure, you're welcome.

>   As I've seen in many cases, the plugin documentation is very rudimentary.

Sorry, but I really can't buy that. To me, the plugin documentation is a
perfect 10: http://maven.apache.org/plugins/maven-enforcer-plugin/

Of course, as maven is basically more a plugin execution engine than a
build tool, you will need some basic maven knowledge, specifically what
a plugin is, and how to configure it. This information is *not*
reproduced in the documentation of each and every plugin, so you should
familiarize yourself with the basic mechanisms before diving into the
(terse) plugin documentation. Some resources:

Online book. "Maven: The Complete Reference". If you have some time to
kill, it's advisable to read it at least up to and including chapter 9
"Properties and resource filtering":
http://www.sonatype.com/books/mvnref-book/reference/

Considering your problem at hand, I'd suggest to pay special attention
to section 1.4 ...
http://www.sonatype.com/books/mvnref-book/reference/installation-sect-universal-reuse.html

and to chapter 7: "How to configure maven plugins:"
http://www.sonatype.com/books/mvnref-book/reference/_configuring_maven_plugins.html

> It looks to me like we would need to specify "enforcer:enforce", but how do I 
> know what this is going to do?

Read the introduction (what is this plugin all about):
http://maven.apache.org/plugins/maven-enforcer-plugin/index.html

Have a look at the sample configuration and put a version tailored to
your needs into your project's pom:
http://maven.apache.org/plugins/maven-enforcer-plugin/usage.html

If you'd like to know more about the available rules which the enforcer
plugin can enforce, this list might help:
http://maven.apache.org/enforcer/enforcer-rules/index.html

As a side note: these pages are what you get when you click link one,
three and five in the main, top-left navigation of the plugin's homepage
(below "Overview"). The homepage can easily be found by googling "maven
enforcer plugin" (it's the first link actually). I'd like to know where
exactly in the process you were unable to find this information or make
sense of the information you might have found, so that the plugin
maintainers can improve presence of this information in search engines
or the documentation itself.

The actual rule you need to configure is documented here:
http://maven.apache.org/enforcer/enforcer-rules/dependencyConvergence.html

Best regards

Ansgar



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to