with the demise of codehaus, lots of people (myself among them), started getting this type of build error:
[ERROR] Failed to execute goal ... on project ...: Execution .. of goal ... failed: Plugin ... or one of its dependencies could not be resolved: Failed to collect dependencies at ... Failed to read artifact descriptor for ...: Could not transfer artifact ... from/to codehaus-snapshots (http://nexus.codehaus.org/snapshots/): nexus.codehaus.org: Unknown host nexus.codehaus.org -> [Help 1
the specifics of the plugin, goal and project involved dont matter and have bee stripped out of the error.
basically what maven is telling us is that it tried to connect to a repository called “codehaus-snapshots” and failed because it could not resolve “nexus.codehaus.org”
tracking down exactly where your project got this repository reference from is problematic, as mvn dependency:list-repositories may not always show them, but maven is telling us the repository name – codehaus-snapshots. all we need to do now is “blacklist” this repository (sort of) by telling maven not to look for either releases or snapshots from it. to do that, you add the following bit of xml to your <repositories> section:
<repository> <id>codehaus-snapshots</id> <url>whatever</url> <snapshots> <enabled>false</enabled> </snapshots> <releases> <enabled>false</enabled> </releases> </repository>
and to be extra safe, we need to add something very similar to the <pluginRepositories>, since maven distinguishes between dependency and plugin repositories:
<pluginRepository> <id>codehaus-snapshots</id> <url>whatever</url> <snapshots> <enabled>false</enabled> </snapshots> <releases> <enabled>false</enabled> </releases> </pluginRepository>
this repository that we’ve just defined overrides the “real” repository (because we’ve used the same name) and maven will never access it for anything. you may have to repeat this process several times if your dependencies refer to codehaus by various other names. in my project i had to define “codehaus.org”, “codehaus-snapshots” and “snapshots.codehaus.org” (for 6 xml elements in total).
only then did i discover that this was masking some other real issue, but such is life