Uploaded image for project: 'Maven'
  1. Maven
  2. MNG-7349

Limit relocation warning message to direct dependencies only

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 3.8.3, 3.8.4
    • 3.8.5, 4.0.0-alpha-2, 4.0.0
    • Core
    • None

    Description

      In the commit that solved MNG-7253, the check for relocations was moved from the DefaultProjectDependenciesResolver to the DefaultArtifactDescriptorReader. This means that the relocation messages are not only shown on project dependencies, but on any artifact that is read.

      This may lead to unfixable WARNINGS in the output if a plugin transitively uses a relocated artifact.
      This can be reproduced by calling mvn dependency:tree with a simple, empty pom.xml. This will give the following warning:

      [WARNING] The artifact xml-apis:xml-apis:jar:2.0.2 has been relocated to xml-apis:xml-apis:jar:1.0.b2
      

      The default maven-dependency-plugin version is 2.8 and it depends on org.apache.maven.reporting:maven-reporting-impl:2.0.5, which depends on commons-validator:commons-validator:1.2.0 which depends on xml-apis:xml-apis:2.0.2.

      In this particular case, updating to a recent maven-dependency-plugin version solves the issue. But since the transitive dependencies of plugins are not under the control of the end users, I don't think this warning should be shown.

      Workaround:
      Stay on Maven 3.8.2 or disable logging on the DefaultArtifactDescriptorReader:

      -Dorg.slf4j.simpleLogger.log.org.apache.maven.repository.internal.DefaultArtifactDescriptorReader=error
      

      Although this disables all relocation messages, including the ones you might be interested in.

      Attachments

        Activity

          People

            gnodet Guillaume Nodet
            joepweijers Joep Weijers
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: