Maven cannot download a build plugin such as maven-dependency-plugin
Your error
[ERROR] Plugin org.apache.maven.plugins:maven-dependency-plugin:3.1 or one of its dependencies could not be resolved2 more lines it can showFix it fast
Most common cause, 1 of 3The network needs a proxy and Maven has none configured
Add the proxy to ${user.home}/.m2/settings.xml.
<settings>
<proxies>
<proxy>
<id>company-proxy</id>
<active>true</active>
<protocol>http</protocol>
<host>proxy.example.com</host>
<port>8080</port>
<nonProxyHosts>localhost|*.example.com</nonProxyHosts>
</proxy>
</proxies>
</settings>Short answer
'Plugin ... or one of its dependencies could not be resolved' means Maven failed to download that plugin. Usually the network needs a proxy missing from settings.xml, a repository uses plain http://, blocked since Maven 3.8.1, or an earlier failure is cached in ~/.m2. Fix the reason after the colon, then rerun with -U. Applies to Maven 3.9.16 and 3.10.1.
Which cause do you have?
Run the same goal with error details and read the sentence after 'could not be resolved:'. A timeout or unknown host points to cause 1, 'Blocked mirror' to cause 2, and 'during a previous attempt' to cause 3.
mvn -e package 2>&1 | grep -iE "could not be resolved|blocked mirror|previous attempt"Then find the line you see in this list and open its fix:
- 1The network needs a proxy and Maven has none configured
The reason after the colon is a connection timeout or an unknown host for repo.maven.apache.org, and the browser on the same machine works - 2A repository or mirror on plain http:// is blocked by Maven 3.8.1 and later
The output names maven-default-http-blocker (http://0.0.0.0/) and says Blocked mirror for repositories, followed by the repository id and its http:// URL - 3An earlier failed download is cached in the local repository
The reason says the plugin failed to transfer during a previous attempt and that resolution is not reattempted until the update interval has elapsed
What does the error look like?
[ERROR] Plugin org.apache.maven.plugins:maven-dependency-plugin:3.1 or one of its dependencies could not be resolvedmaven-default-http-blocker (http://0.0.0.0/): Blocked mirror for repositoriesThis failure was cached in the local repository and resolution will not be reattempted until the update interval
Cause 1 of 3
The network needs a proxy and Maven has none configured
You seeThe reason after the colon is a connection timeout or an unknown host for repo.maven.apache.org, and the browser on the same machine works
Check
Maven's own help page for this plugin error lists a general network problem, such as a missing proxy configuration, as a cause. Your browser may follow a system or PAC proxy; Maven's proxy is set separately, in settings.xml. Test Maven Central with and without the company proxy.
curl -I https://repo.maven.apache.org/maven2/
curl -I -x http://proxy.example.com:8080 https://repo.maven.apache.org/maven2/Fix
Add the proxy to ${user.home}/.m2/settings.xml. Username and password are only needed when the proxy asks for Basic login, and nonProxyHosts lists hosts that must be reached directly, separated by |.
<settings>
<proxies>
<proxy>
<id>company-proxy</id>
<active>true</active>
<protocol>http</protocol>
<host>proxy.example.com</host>
<port>8080</port>
<nonProxyHosts>localhost|*.example.com</nonProxyHosts>
</proxy>
</proxies>
</settings>Verify
Run the build again with -U. The plugin is fetched and the build gets past the step that failed, with no resolution error.
mvn -U packageConfirmed by maven.apache.org
Cause 2 of 3
A repository or mirror on plain http:// is blocked by Maven 3.8.1 and later
You seeThe output names maven-default-http-blocker (http://0.0.0.0/) and says Blocked mirror for repositories, followed by the repository id and its http:// URL
Check
Since 3.8.1 Maven ships a mirror in conf/settings.xml that blocks external repositories using HTTP, to stop man-in-the-middle downloads. A company Nexus or Artifactory added with an http:// URL, in the POM or in settings.xml, is caught by that blocker, and so is an old http:// repository declared inside a dependency's POM.
grep -n "<url>http://" pom.xml ~/.m2/settings.xml 2>/dev/nullFix
Change the repository or mirror URL to https:// where it is defined. If the http:// repository comes from a dependency's POM, upgrade that dependency to a version that uses HTTPS, or keep the version and define a mirror in your settings that points to an HTTPS location.
<!-- ~/.m2/settings.xml -->
<mirrors>
<mirror>
<id>company-repo</id>
<url>https://repo.example.com/maven2</url>
<mirrorOf>*</mirrorOf>
</mirror>
</mirrors>Verify
The Blocked mirror line is gone and the plugin downloads from the https:// URL.
mvn -U -e package 2>&1 | grep -ic "blocked mirror"Confirmed by maven.apache.org
Cause 3 of 3
An earlier failed download is cached in the local repository
You seeThe reason says the plugin failed to transfer during a previous attempt and that resolution is not reattempted until the update interval has elapsed
Check
For speed, Maven remembers that a plugin could not be downloaded. After you fix the proxy or the URL, the build can keep failing with the old reason until that record expires. The Maven help page for this error says to add -U so your correction takes effect.
ls ~/.m2/repository/org/apache/maven/plugins/maven-dependency-plugin/*/ 2>/dev/null | grep lastUpdatedFix
Rerun with -U, which forces Maven to check remote repositories for missing releases. If that still reuses stale files, delete the folder of that one plugin from the local repository and build again.
mvn -U package
# if needed, remove only the failing plugin's folder:
rm -rf ~/.m2/repository/org/apache/maven/plugins/maven-dependency-pluginVerify
The build no longer mentions a previous attempt, and the plugin folder in ~/.m2 now holds a .jar instead of only .lastUpdated files.
mvn -U package 2>&1 | grep -i "maven-dependency-plugin"Confirmed by cwiki.apache.org
How do I stop it coming back?
- Keep one shared settings.xml for the team with the proxy and an https:// mirror, and check it into your dev setup docs or CI image.
- Pin plugin versions in pluginManagement, so a typo or a missing version cannot send Maven looking for an artifact that does not exist.
- In CI, cache ~/.m2/repository but run builds with -U after changing repository or proxy settings.
Sources
How was this page made?
I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.