Maven无法解析Spring Cloud Dependencies Finchley.M9问题求助
Hey there, let's work through this issue step by step. You're hitting a java.net.ConnectException when trying to pull the spring-cloud-dependencies:pom:Finchley.M9 artifact, which usually boils down to either a network connectivity problem or an incorrect repository setup in your pom.xml. Here's how to fix it:
Finchley.M9 is a milestone release, so it won't be available in Maven Central—you need the Spring Milestone Repository configured properly. Make sure your pom.xml has this full, untruncated repo setup:
<repositories> <repository> <id>spring-milestones</id> <name>Spring Milestones</name> <url>https://repo.spring.io/milestone</url> <snapshots> <enabled>false</enabled> </snapshots> </repository> </repositories> <pluginRepositories> <pluginRepository> <id>spring-milestones</id> <name>Spring Milestones</name> <url>https://repo.spring.io/milestone</url> <snapshots> <enabled>false</enabled> </snapshots> </pluginRepository> </pluginRepositories>
You mentioned your URL starts with https:...—make sure it's complete as above. Don't skip the plugin repository either, since some build tools rely on it for milestone plugins.
The java.net.ConnectException means Maven can't reach the Spring repo. Try these checks:
- First, test if you can load
https://repo.spring.io/milestonein your browser. If it fails, you're probably behind a firewall or proxy. - If you use a proxy, configure Maven to use it by editing your
settings.xml(located in~/.m2/or your Maven installation'sconf/folder):
<settings> <proxies> <proxy> <id>corporate-proxy</id> <active>true</active> <protocol>http</protocol> <host>your-proxy-host.com</host> <port>your-proxy-port</port> <username>your-proxy-username</username> <password>your-proxy-password</password> <nonProxyHosts>localhost|127.0.0.1|*.your-company-domain.com</nonProxyHosts> </proxy> </proxies> </settings>
- If you're on a corporate network, check with your IT team—they might block external repos, so you'll need to use an internal mirror instead.
Corrupted or outdated cached files can cause weird issues. Run these commands in your project directory:
mvn clean install -U: The-Uflag forces Maven to refresh milestone and snapshot dependencies, bypassing cached versions.- If that doesn't work, manually delete the
.m2/repository/org/springframework/cloudfolder, then runmvn installagain to re-download fresh copies.
Finchley.M9 is a pre-release milestone—why not switch to the stable Finchley.RELEASE instead? It's more reliable and available in Maven Central, so you might not even need the milestone repo (though keeping it won't hurt). Update your dependency management section like this:
<dependencyManagement> <dependencies> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-dependencies</artifactId> <version>Finchley.RELEASE</version> <type>pom</type> <scope>import</scope> </dependency> </dependencies> </dependencyManagement>
Give these steps a try, and your pom.xml should resolve the artifact without that frustrating connection error. If you hit any other roadblocks, let me know!
内容的提问来源于stack exchange,提问作者raghav

