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.
[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.
<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.
<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.
mvn -X validate
# -X shows which repository Maven queried for the pluginHow 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
~/.m2in CI keyed on the POM so plugin resolution is stable.