How to resolve the common “resolution will not be reattempted” Maven error

Joey Naor
2020-09-29 08:26

Into:

There’s a very common Maven error that occurs when building a new project:[ERROR] Failed to execute goal on project <project-name>: Could not resolve dependencies for project <project-name>. The following artifacts could not be resolved: <artifact>: Failure to find <artifact> in http://artifactory:8081/artifactory/<repo-name> was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced -> [Help 1]
Explanation:
This error is caused by the default "updatePolicy" of Maven. Maven fetches artifacts from the Artifactory repositories on a daily basis. Therefore, if there were any interruptions, it will not attempt to fetch the artifacts for another 24 hours. 

Solution:
To bypass this default restriction, you can either add the -U flag to the “maven install” command, or alternatively configure the Maven clients’ settings.xml file with the following value: <updatePolicy>always</updatePolicy>