Class UserPropertiesArtifactRelocationSource

java.lang.Object
org.apache.maven.repository.internal.relocation.UserPropertiesArtifactRelocationSource
All Implemented Interfaces:
MavenArtifactRelocationSource

@Singleton @Named("userProperties") @Priority(50) public final class UserPropertiesArtifactRelocationSource extends Object implements MavenArtifactRelocationSource
User controlled relocations. This property is a comma separated list of entries with the syntax GAV>GAV. The first GAV can contain * for any elem (so *:*:* would mean ALL, something you don't want). The second GAV is either fully specified, or also can contain *, then it behaves as "ordinary relocation": the coordinate is preserved from relocated artifact. Finally, if right hand GAV is absent (line looks like GAV>), the left hand matching GAV is banned fully (from resolving).
Note: the > means project level, while >> means global (whole session level, so even plugins will get relocated artifacts) relocation.
For example,
maven.relocations.entries = org.foo:*:*>, \\
org.here:*:*>org.there:*:*, \\
javax.inject:javax.inject:1>>jakarta.inject:jakarta.inject:1.0.5
means: 3 entries, ban org.foo group (exactly, so org.foo.bar is allowed), relocate org.here to org.there and finally globally relocate (see >> above) javax.inject:javax.inject:1 to jakarta.inject:jakarta.inject:1.0.5.
Since:
3.10.0
  • Field Details

  • Constructor Details

    • UserPropertiesArtifactRelocationSource

      public UserPropertiesArtifactRelocationSource()
  • Method Details

    • relocatedTarget

      public org.eclipse.aether.artifact.Artifact relocatedTarget(org.eclipse.aether.RepositorySystemSession session, org.eclipse.aether.resolution.ArtifactDescriptorResult artifactDescriptorResult, Model model) throws org.eclipse.aether.resolution.ArtifactDescriptorException
      Description copied from interface: MavenArtifactRelocationSource
      Returns Artifact instance where to relocate to, or null.
      Specified by:
      relocatedTarget in interface MavenArtifactRelocationSource
      Parameters:
      session - The session, never null.
      artifactDescriptorResult - The artifact descriptor result, never null.
      model - The artifact model, never null.
      Returns:
      The Artifact to relocate to, or null if no relocation wanted.
      Throws:
      org.eclipse.aether.resolution.ArtifactDescriptorException