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
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 ( connection timed out to http://

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

Leave a Reply

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

You are commenting using your 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