英文:
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>
英文:
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">
<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>`
Below is my 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>
答案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.
<host>Your Proxy Host Here</host>
<port>Your Proxy Port Here</port>
If both username and password is required to establish the connection, use your actual credentials like this:
<host>Your Proxy Host Here</host>
<port>Your Proxy Port Here</port>
<username>Your Username Here</username>
<password>Your Password Here</password>
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论