apache/maven · warning

The artifact {} has been relocated to {}{}

Error message

The artifact {} has been relocated to {}{}

What it means

While reading a plugin's artifact descriptor (RepositorySystem.readArtifactDescriptor) in DefaultPluginDependenciesResolver, the resolver applies relocation metadata. If the descriptor recorded relocations, the plugin artifact you referenced was moved, so Maven warns 'The artifact <original> has been relocated to <new>' (plus the relocation message, if any) and continues with the new coordinates. Purely informational: the build uses the relocated artifact transparently.

Source

Thrown at impl/maven-core/src/main/java/org/apache/maven/plugin/internal/DefaultPluginDependenciesResolver.java:126

        try {
            DefaultRepositorySystemSession pluginSession = new DefaultRepositorySystemSession(session);
            pluginSession.setArtifactDescriptorPolicy(new SimpleArtifactDescriptorPolicy(true, false));

            ArtifactDescriptorRequest request =
                    new ArtifactDescriptorRequest(pluginArtifact, repositories, REPOSITORY_CONTEXT);
            request.setTrace(trace);
            ArtifactDescriptorResult result = repoSystem.readArtifactDescriptor(pluginSession, request);

            for (MavenPluginDependenciesValidator dependenciesValidator : dependenciesValidators) {
                dependenciesValidator.validate(session, pluginArtifact, result);
            }

            pluginArtifact = result.getArtifact();

            if (logger.isWarnEnabled() && !result.getRelocations().isEmpty()) {
                String message =
                        pluginArtifact instanceof RelocatedArtifact relocated ? ": " + relocated.getMessage() : "";
                logger.warn(
                        "The artifact {} has been relocated to {}{}",
                        result.getRelocations().get(0),
                        pluginArtifact,
                        message);
            }

            String requiredMavenVersion = (String) result.getProperties().get("prerequisites.maven");
            if (requiredMavenVersion != null) {
                Map<String, String> props = new LinkedHashMap<>(pluginArtifact.getProperties());
                props.put("requiredMavenVersion", requiredMavenVersion);
                pluginArtifact = pluginArtifact.setProperties(props);
            }
        } catch (ArtifactDescriptorException e) {
            throw new PluginResolutionException(plugin, e.getResult().getExceptions(), e);
        }

        try {
            ArtifactRequest request = new ArtifactRequest(pluginArtifact, repositories, REPOSITORY_CONTEXT);

View on GitHub (pinned to e4093d4e12)

Solutions

  1. Update the plugin declaration in the POM to the relocated coordinates shown in the warning.
  2. Upgrade to a plugin version that natively uses the new coordinates (often the reason for relocation).
  3. If the relocation is unexpected, verify the repository/mirror serving metadata is trustworthy and not injecting relocations.

Example fix

<!-- before: relocated plugin coordinates -->
<plugin>
  <groupId>com.example.old</groupId>
  <artifactId>build-helper</artifactId>
</plugin>

<!-- after: use relocated coordinates from the warning -->
<plugin>
  <groupId>org.codehaus.mojo</groupId>
  <artifactId>build-helper-maven-plugin</artifactId>
  <version>3.6.0</version>
</plugin>
Defensive patterns

Strategy: fallback

Validate before calling

# guard: detect relocation before committing coordinates
mvn dependency:get -Dartifact=old.gid:old-art:1.0 2>&1 | grep -i 'has been relocated' \
  && echo 'update POM to relocated coordinates'

Prevention

When it happens

Trigger: Declaring or implicitly pulling a plugin whose POM/metadata contains <relocation> to new groupId/artifactId — e.g. javax.xml.bind:jaxb-* -> org.glassfish.jaxb:*, commons-logging stubs, plugins moved to new groupIds; first resolution after an upstream project relocates.

Common situations: Ecosystem-wide coordinate migrations (Jakarta EE, new groupIds); stale plugin versions whose maintainers published relocations; builds continuing to work but pulling different GAVs than the POM says — surprising during dependency audits or license scanning.

Related errors


AI-assisted analysis of apache/maven@e4093d4e12 (2026-08-21). Data as JSON: /api/errors/70c3a266c109ffd1. Report an issue: GitHub.