spring-boot-starter-web 项目无法读取 org.hibernate:hibernate-validator:jar:5.3.5.Final 的工件描述符

问题描述 投票:0回答:1
java spring hibernate maven
1个回答
0
投票

这可能是由于默认偏好使用 IPv6 造成的。你可以发现它添加

-e
参数到你的maven命令(如
mvn clean install -e
) - 它会打印失败的堆栈跟踪。在这种情况下,它看起来像:

Caused by: java.net.UnknownHostException: repo.maven.apache.org: nodename nor servname provided, or not known
    at java.net.Inet6AddressImpl.lookupAllHostAddr (Native Method)
    at java.net.InetAddress$PlatformNameService.lookupAllHostAddr (InetAddress.java:933)
    at java.net.InetAddress.getAddressesFromNameService (InetAddress.java:1529)
    at java.net.InetAddress$NameServiceAddresses.get (InetAddress.java:852)
    at java.net.InetAddress.getAllByName0 (InetAddress.java:1519)
    at java.net.InetAddress.getAllByName (InetAddress.java:1377)
    at java.net.InetAddress.getAllByName (InetAddress.java:1305)
    at org.apache.http.impl.conn.SystemDefaultDnsResolver.resolve (SystemDefaultDnsResolver.java:45)
...

要解决这个问题,请通过文件添加maven参数

.mvn/jvm.config
(如果不存在则创建):

-Djava.net.preferIPv4Stack=true

顺便说一句,您可以将此文件用于其他 Maven jvm 选项,例如

-Djava.awt.headless=true -Xmx1024m -Djava.net.preferIPv4Stack=true
© www.soinside.com 2019 - 2024. All rights reserved.