Maven Pom Transfer Artifact Error


One nice little problem that has given us a bit of trouble recently is pom errors where non were expected.

A typical error message would be:

Failure to transfer org.apache.maven.plugins:maven-resources-plugin:pom:2.5 from http://repo.maven.apache.org/
maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has
elapsed or updates are forced. Original error: Could not transfer artifact org.apache.maven.plugins:maven-resources-
plugin:pom:2.5 from/to central (http://repo.maven.apache.org/maven2): connection timed out to http://
repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-resources-plugin/2.5/maven-resources-
plugin-2.5.pom

This is cause by failed repository downloads, where Maven thinks they have already downloaded and so Maven cannot build the project.

The solution to this is to remove all your failed downloads:

On a mac open a terminal shell and run the following:

find ~/.m2  -name "*.lastUpdated" -exec grep -q "Could not transfer" {} \; -print -exec rm {} \;

On Windows run the following:

cd %userprofile%\.m2\repository
for /r %i in (*.lastUpdated) do del %i
Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s