Problem Description:
New in pom file in a certain dependence in the IDE Import Changes
or Reimport
always only be seen in the local repository .lastUpdated
file and can not obtain the specified jar package. (And possibly other companies per capita there is no problem, except you hit the jackpot)
Invalid solution (note is invalid):
- Modify the maven
settings.xml
to add or modifymirror
, or other configuration (not the central warehouse issues); - Delete
.lastUpdated
the file (it will be resurrected after deletion); - Delete the local repository
.m2
folder (downloaded again, too) - Re-download maven (not a problem maven version)
- …
Solution:
Used in the project path mvn -U compile
can be ordered!
-U
The effect is to force Maven to check all dependent updated to ensure integration based on the latest state to note is -U
that a parameter can not be used directly mvn -U
, it will tell you:
[ERROR] No goals have been specified for this build. You must specify a valid lifecycle phase or a goal...
Therefore, the need to add an executable command.
Because what we want is -U
action parameters, so the above mvn -U compile
commands can also be replaced mvn -U package
, mvn -U install
and so on.
But attention mvn -U clean
is not valid because only a clean-clean function, relations with jar package we want.
Other solutions:
to jar maven central warehouse directly download the package into the .m2
corresponding folder.