On Tue, Aug 20, 2013 at 9:36 AM, Phillip Hellewell <ssh...@gmail.com> wrote:
> I believe the behavior needs to be defined in the parent
> pom, e.g., in a new tag called <dependencyMediationManagement> or something
> (help me think of a good name).

Besides "nearest" and "newest", we'll want a "fail" strategy, which
means fail the build on version conflict.  (Currently I am
accomplishing this with a plugin I wrote, but it's better here).

Also, I need the flexibility to combine these strategies, e.g., using
a different strategy depending on the artifact name.

How does this look?  Please comment or make suggestions to improve it.

<!-- Maven will use the last strategy that matches the conditions -->
<dependencyMediationManagement>
  <!-- use "nearest definition" by default -->
  <!-- this section isn't needed; it exists implicitly for backwards
compatibility -->
  <mediation>
    <strategy>nearest</strategy>
  </mediation>

  <!-- override default behavior; we normally want to fail on version
conflict -->
  <mediation>
    <strategy>fail</strategy>
  </mediation>

  <!-- we want these components to use newest version instead of failing -->
  <mediation>
    <strategy>newest</strategy>
    <condition>
      <groupRegex>^ad\.</groupRegex>
      <artifactRegex>(-types|-enums)$</artifactRegex>
      <versionMatch>3</versionMatch> <!-- First 3 parts of version
must match -->
    </condition>
  </mediation>
</dependencyMediationManagement>

The rules in the <condition> tag are AND-ed (i.e., they have to all
match in order for it to employ the specified strategy).
Multiple <condition> tags are OR-ed together (i.e., if any condition
matches, employ the strategy).

Thanks,
Phillip

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@maven.apache.org
For additional commands, e-mail: dev-h...@maven.apache.org

Reply via email to