Skip to content
Latchkey

Maven "Could not resolve plugin org.apache.maven.plugins" - Fix in CI

Maven needed a build plugin and could not download it from any configured plugin repository. Either the version does not exist, the plugin repo is unreachable, or a strict mirror is blocking Central.

What this error means

The build fails before any goal runs with Plugin org.apache.maven.plugins:maven-surefire-plugin:3.x.y or one of its dependencies could not be resolved, sometimes citing Could not find artifact for the plugin coordinates.

maven
[ERROR] Plugin org.apache.maven.plugins:maven-surefire-plugin:3.2.5 or one
of its dependencies could not be resolved: Could not find artifact
org.apache.maven.plugins:maven-surefire-plugin:jar:3.2.5 in central
(https://repo.maven.apache.org/maven2) -> [Help 1]

Common causes

A non-existent or typo plugin version

The pinned plugin version was never published, so no repository can serve it.

Plugin repository unreachable or blocked

A mirror with mirrorOf=* or a corporate proxy intercepts the request and the real plugin repo is never queried.

No plugin repository configured

A custom plugin lives on a private registry that is declared as a <repository> but not a <pluginRepository>, so plugin resolution skips it.

How to fix it

Verify and pin a published plugin version

Confirm the exact coordinates exist on Central or your registry and pin them in pluginManagement.

pom.xml
<pluginManagement>
  <plugins>
    <plugin>
      <groupId>org.apache.maven.plugins</groupId>
      <artifactId>maven-surefire-plugin</artifactId>
      <version>3.2.5</version>
    </plugin>
  </plugins>
</pluginManagement>

Declare the plugin repository

For custom plugins, point Maven at the registry that hosts them.

pom.xml
<pluginRepositories>
  <pluginRepository>
    <id>company-plugins</id>
    <url>https://nexus.example.com/repository/maven-public/</url>
  </pluginRepository>
</pluginRepositories>

Make the mirror cover plugin repos correctly

If a mirror intercepts everything, ensure it actually proxies the plugin artifacts too.

Terminal
mvn -X validate
# -X shows which repository Maven queried for the plugin

How to prevent it

  • Pin every plugin version in pluginManagement; never rely on LATEST/implicit versions.
  • Keep a single proxy repo that mirrors both artifacts and plugins.
  • Cache ~/.m2 in CI keyed on the POM so plugin resolution is stable.

Frequently asked questions

What causes ""Could not resolve plugin""?
The pinned plugin version was never published, so no repository can serve it.
How do I fix "Could not resolve plugin"?
Confirm the exact coordinates exist on Central or your registry and pin them in pluginManagement.

Related guides

References

Latchkey auto-heals failures like this one - detected, fixed, and retried without you. Start free → 30-day trial · No credit card