问题
Yesterday when I tried building a common service, it yield an error
253 Caused by: org.eclipse.aether.resolution.ArtifactResolutionException: The following artifacts could not be resolved: org.geotools:gt-main:jar:21.2, org.geotools:gt-epsg-wkt:jar:21.2, org.geotools:gt-epsg-hsql:jar:21.2: Could not find artifact org.geotools:gt-main:jar:21.2 in spring-milestones (https://repo.spring.io/milestone)
It was success just a few hours ago, before the issue occurs. No change has been made for a long while.
We use several repository, one of them is http://download.osgeo.org/webdav/geotools. But it seems the URL is down now. No idea when and why it was down - I can't find anything on the osgeo.org home page.
Is there anyway to get warnings about this kind of issue? What should I do to prevent the problem from happening again?
回答1:
The repository moved, and we were unable to get maven to handle a redirect.
See http://geotoolsnews.blogspot.com/2020/04/change-to-maven-repositories.html?m=1 for more details.
So now you need this in your pom.xml
files:
<repositories>
<repository>
<id>osgeo</id>
<name>OSGeo Release Repository</name>
<url>https://repo.osgeo.org/repository/release/</url>
<snapshots><enabled>false</enabled></snapshots>
<releases><enabled>true</enabled></releases>
</repository>
</repositories>
Or you can add this to your ~/.m2/settings.xml
file:
<mirrors>
<mirror>
<id>osgeo-release</id>
<name>OSGeo Repository</name>
<url>https://repo.osgeo.org/repository/release/</url>
<mirrorOf>osgeo</mirrorOf>
</mirror>
<mirror>
<id>geoserver-releases</id>
<name>Boundless Repository</name>
<url>https://repo.osgeo.org/repository/Geoserver-releases/</url>
<mirrorOf>boundless</mirrorOf>
</mirror>
</mirrors>
来源:https://stackoverflow.com/questions/61226545/geotools-lib-suddenly-disappear-from-repository