项目构建错误:无法解析的父POM – Spring Boot

huangapple go评论99阅读模式
英文:

Project build error: Non-resolvable parent POM - Spring boot

问题

以下是翻译好的部分:

我尝试创建一个Spring Boot项目,但是当我在pom文件中放入<parent>依赖时,出现了一个错误。我已经尝试访问http://repo.spring.io网址,它是可以访问的。我尝试更改了代理设置,但问题没有解决。我甚至删除了settings.xml并进行了检查。
我在下面提到了我的Maven和JDK版本。

Maven安装目录:C:\Program Files\apache-maven-3.6.3-bin*apache-maven-3.6.3*\bin..
Java版本:15.0.1,供应商:Oracle Corporation,运行时:C:\Program Files\Java*jdk-15.0.1*

以下是我的pom文件依赖项。

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

    <modelVersion>4.0.0</modelVersion>
    <groupId>com.dm.boot</groupId>
    <artifactId>springboot-demo</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>Springboot  Demo App</name>

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.2.6.RELEASE</version>
    </parent>

以下是我的settings.xml

<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
                      http://maven.apache.org/xsd/settings-1.0.0.xsd">
<proxies>

<proxy>
  <id>example-proxy</id>
  <active>true</active>
  <protocol>http</protocol>
  <host>proxy.example.com</host>
  <port>8080</port>
  <username>proxyuser</username>
  <password>somepassword</password>
  <nonProxyHosts>www.google.com|*.example.com</nonProxyHosts>
</proxy>

</proxies>

项目构建错误:无法解析的父POM – Spring Boot

英文:

I have tried to make a spring boot project, but when I put a <parent> dependency inside pom file, there is an error. I have tried reach http://repo.spring.io url and it can be reachable. I tried to change the proxy settings and the problem was not solved. Even settings.xml I removed and checked.
I have mentioned in below my maven and JDK version.

Maven home: C:\Program Files\apache-maven-3.6.3-bin*apache-maven-3.6.3*\bin..
Java version: 15.0.1, vendor: Oracle Corporation, runtime: C:\Program Files\Java*jdk-15.0.1*

Below is my pom file dependencies.

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd&quot;>

&lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
  &lt;groupId&gt;com.dm.boot&lt;/groupId&gt;
  &lt;artifactId&gt;springboot-demo&lt;/artifactId&gt;
  &lt;version&gt;0.0.1-SNAPSHOT&lt;/version&gt;
  &lt;name&gt;Springboot  Demo App&lt;/name&gt;

&lt;parent&gt;
		&lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
		&lt;artifactId&gt;spring-boot-starter-parent&lt;/artifactId&gt;
		&lt;version&gt;2.2.6.RELEASE&lt;/version&gt;
&lt;/parent&gt;`

Below is my settings.xml

 &lt;settings xmlns=&quot;http://maven.apache.org/SETTINGS/1.0.0&quot;
  xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;
  xsi:schemaLocation=&quot;http://maven.apache.org/SETTINGS/1.0.0
                      http://maven.apache.org/xsd/settings-1.0.0.xsd">
&lt;proxies&gt;

&lt;proxy&gt;
  &lt;id&gt;example-proxy&lt;/id&gt;
  &lt;active&gt;true&lt;/active&gt;
  &lt;protocol&gt;http&lt;/protocol&gt;
  &lt;host&gt;proxy.example.com&lt;/host&gt;
  &lt;port&gt;8080&lt;/port&gt;
  &lt;username&gt;proxyuser&lt;/username&gt;
  &lt;password&gt;somepassword&lt;/password&gt;
  &lt;nonProxyHosts&gt;www.google.com|*.example.com&lt;/nonProxyHosts&gt;
&lt;/proxy&gt;

</proxies>

项目构建错误:无法解析的父POM – Spring Boot

答案1

得分: 1

尝试在 ~/.m2/settings.xml 文件中指定实际的代理主机和端口,如果可以在不指定用户名和密码的情况下建立连接,请删除用户名和密码。

<host>在这里填入您的代理主机</host>
<port>在这里填入您的代理端口</port>

如果建立连接需要用户名和密码,请使用实际的凭据进行配置:

<host>在这里填入您的代理主机</host>
<port>在这里填入您的代理端口</port>
<username>在这里填入您的用户名</username>
<password>在这里填入您的密码</password>
英文:

Try specifying your actual proxy host and port in the ~/.m2/settings.xml and remove the username and password if you can establish the connection without specifying username and password.

&lt;host&gt;Your Proxy Host Here&lt;/host&gt;
&lt;port&gt;Your Proxy Port Here&lt;/port&gt;

If both username and password is required to establish the connection, use your actual credentials like this:

&lt;host&gt;Your Proxy Host Here&lt;/host&gt;
&lt;port&gt;Your Proxy Port Here&lt;/port&gt;
&lt;username&gt;Your Username Here&lt;/username&gt;
&lt;password&gt;Your Password Here&lt;/password&gt;

huangapple
  • 本文由 发表于 2020年10月22日 05:49:48
  • 转载请务必保留本文链接:https://go.coder-hub.com/64472207.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定