Friday 27 July 2012

Maven: How to Refresh Dependencies in a Project?

There are situations where a simple mvn clean will not be enough to get rid of corrupted files or dependencies in a maven project. This can happen when a PC crashes during a compilation process or when the Internet connection is lost.

For example, one can encounter the following error message:
Build errors for XXX;
  org.apache.maven.lifecycle.LifecycleExecutionException:
Failed to execute goal on project YYY:
Could not resolve dependencies for project ZZZ:
The following artifacts could not be resolved: 
...
mvn clean will only clean the target (build) directory.

In order to force dependencies updates, one can use:
mvn clean install -U

No comments:

Post a Comment