You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Spring Boot项目Maven依赖报错求助:无法解析父POM

Fixing "Non-resolvable parent POM" Error in Spring Boot

Hey there, let's break down this error and fix it together! The message is pointing to two key issues: Maven can't connect to the central repository to fetch the spring-boot-starter-parent POM (due to a timeout), and it also can't find a local copy via the parent.relativePath setting. Here are actionable steps to resolve this:

1. Verify Network & Proxy Settings

First, rule out connectivity problems:

  • Check if you can access the Maven Central repo directly in your browser: try loading the path for your target parent POM. If it doesn't load, your network is blocked or has proxy restrictions.
  • If you're behind a corporate proxy, configure it in your Maven settings.xml (located at ~/.m2/settings.xml or <maven-install-dir>/conf/settings.xml):
    <proxies>
      <proxy>
        <id>corporate-proxy</id>
        <active>true</active>
        <protocol>http</protocol>
        <host>your-proxy-host</host>
        <port>your-proxy-port</port>
        <!-- Add username/password if required -->
        <!-- <username>proxy-user</username> -->
        <!-- <password>proxy-pass</password> -->
        <nonProxyHosts>localhost|127.0.0.1|*.your-company-domain.com</nonProxyHosts>
      </proxy>
    </proxies>
    
  • For temporary testing, you can bypass SSL checks (not recommended for production) with this Maven command:
    mvn clean install -Dmaven.wagon.http.ssl.insecure=true -Dmaven.wagon.http.ssl.allowall=true
    

2. Manually Download the Parent POM to Local Repository

If network issues persist, grab the POM directly:

  • Search for org.springframework.boot:spring-boot-starter-parent:pom:2.0.2.RELEASE on Maven Central, and download the POM file.
  • Place it in your local Maven repo's corresponding path: ~/.m2/repository/org/springframework/boot/spring-boot-starter-parent/2.0.2.RELEASE/spring-boot-starter-parent-2.0.2.RELEASE.pom
    • Make sure the directory structure matches exactly—Maven relies on this path to locate local artifacts.

3. Check & Adjust parent.relativePath in Your POM

Double-check your project's pom.xml parent configuration:

  • If you have a local copy of the Spring Boot parent POM (e.g., in a sibling project), set relativePath to point to it:
    <parent>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-parent</artifactId>
      <version>2.0.2.RELEASE</version>
      <relativePath>../spring-boot-starter-parent/pom.xml</relativePath> <!-- Example local path -->
    </parent>
    
  • If you don't have a local copy, remove the relativePath attribute entirely—Maven will automatically look in your local repo and then the central repo once connectivity is fixed.

4. Refresh & Rebuild the Project

  • In your IDE (IntelliJ, Eclipse, etc.), run mvn clean install via the terminal or IDE's Maven toolbar.
  • For IDE-specific fixes: click "Reload All Maven Projects" (IntelliJ) or "Update Maven Project" (Eclipse) to refresh dependencies.

内容的提问来源于stack exchange,提问作者Ananya

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.27 10:00:54