How many times have I seen this – ‘artifact org.apache.maven.plugins:maven-resources-plugin’ could not be retrieved from repository’ blah blah blah. I usually resolve this by re-running the commands over and over until the artifact does get resolved. Today though I thought enough was enough.
After a little digging about I discover that the plugins attached to lifecycle phases (eg. compile) are downloaded and stored automatically when they are needed. So calling ‘mvn compile’ means that all plugins attached to the compile phase, and the phases that come after it in the lifecycle (generate-sources, process-resources etc), are downloaded and executed and stored.
The plugins that you call from the command line (eg. mvn install) are downloaded and stored in the repository only when you call them from the command line. This is the case even if they are configured in your pom.xml.
You can try and force Maven to download the dependencies that it needs with the command “mvn dependency:go-offline” (see http://maven.apache.org/plugins/maven-dependency-plugin/).
For more information regarding the Maven life-cycle see http://maven.apache.org/guides/introduction/introduction-to-the-lifecycle.html