Not a v4.0.0 POM. for project net.java:jvnet-parent

mvn打包的时候一直报这个错误,搞了很长时间才搞定,解决办法:在settings.xml中增加配置
<mirror>
<id>glassfish-mirror</id>
<name>glassfish mirror</name>
<url>http://maven.nuxeo.org/nexus/content/repositories/public-releases</url>
<mirrorOf>glassfish-repository</mirrorOf>
</mirror>

重新打包,ok了。

参考连接:[url]http://answers.nuxeo.com/questions/2195/cant-build-nuxeo-source-nuxeo-webengine-jax-rs-jersey-server-error[/url]
### 问题分析与解决方案 在Maven项目中,`Non-resolvable parent POM` 错误通常表明Maven无法解析父POM文件。这可能是由于网络问题、仓库配置错误或版本号不正确等原因引起的。以下是针对`org.springframework.boot:spring-boot-starter-parent:pom:2.7.13-SNAPSHOT`版本缺失的具体解决方案。 --- #### 1. 检查Spring Boot版本是否存在 首先需要确认`spring-boot-starter-parent:2.7.13-SNAPSHOT`是否存在于官方Maven中央仓库或其他指定的远程仓库中。可以通过以下链接查询: - Maven Central Repository: [https://search.maven.org/](https://search.maven.org/) - Spring Milestone Repository: [https://repo.spring.io/milestone/](https://repo.spring.io/milestone/) 如果该版本确实不存在,则可能是版本号拼写错误或尚未发布。建议使用已发布的稳定版本(如`2.7.13`而非`2.7.13-SNAPSHOT`)[^1]。 ```xml <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>2.7.13</version> <!-- 修改为稳定版本 --> </parent> ``` --- #### 2. 配置正确的Maven镜像 如果需要使用SNAPSHOT版本,确保本地`settings.xml`文件中配置了支持SNAPSHOT的仓库地址。例如: ```xml <mirrors> <mirror> <id>aliyun</id> <name>Aliyun Maven</name> <url>https://maven.aliyun.com/repository/spring</url> <mirrorOf>*</mirrorOf> </mirror> </mirrors> ``` 此外,可以在`pom.xml`中显式声明仓库地址: ```xml <repositories> <repository> <id>spring-milestones</id> <name>Spring Milestones</name> <url>https://repo.spring.io/milestone</url> </repository> <repository> <id>spring-snapshots</id> <name>Spring Snapshots</name> <url>https://repo.spring.io/snapshot</url> <snapshots> <enabled>true</enabled> </snapshots> </repository> </repositories> ``` --- #### 3. 检查本地Maven缓存 有时本地Maven缓存可能损坏,导致无法正确下载依赖。可以尝试清理缓存并重新构建项目: ```bash mvn clean install -U ``` 参数`-U`强制更新快照依赖项。 如果问题仍然存在,可以手动删除相关缓存目录,路径通常为: ``` ~/.m2/repository/org/springframework/boot/spring-boot-starter-parent/ ``` 然后重新运行`mvn clean install`命令。 --- #### 4. 确保`parent.relativePath`配置正确 如果项目是多模块结构,父POM的位置可能通过`relativePath`属性指定。默认情况下,`relativePath`指向`../pom.xml`。如果父POM位于其他位置,需明确设置: ```xml <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>2.7.13-SNAPSHOT</version> <relativePath>../../parent/pom.xml</relativePath> <!-- 根据实际路径调整 --> </parent> ``` 如果父POM不存在于本地项目中,则需要从远程仓库下载,此时应确保仓库配置正确[^3]。 --- #### 5. 检查证书问题 如果报错信息中包含`PKIX path building failed`,说明可能存在SSL证书验证失败的问题。可以通过以下方法解决: 1. **信任所有证书**(仅用于测试环境): 在`settings.xml`中添加以下配置: ```xml <servers> <server> <id>central</id> <configuration> <sslSupport>true</sslSupport> <httpConfiguration> <all> <params> <property> <name>http.conn.ssl.allow-untrusted</name> <value>true</value> </property> </params> </all> </httpConfiguration> </configuration> </server> </servers> ``` 2. **导入正确的CA证书**: 下载目标仓库的SSL证书,并将其导入JDK的信任库: ```bash keytool -import -trustcacerts -keystore $JAVA_HOME/jre/lib/security/cacerts -storepass changeit -alias alimaven -file alimaven.cer ``` --- ### 示例代码 以下是一个完整的`pom.xml`示例,适用于`spring-boot-starter-parent`的SNAPSHOT版本: ```xml <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> <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>2.7.13-SNAPSHOT</version> <relativePath/> <!-- 使用默认值 --> </parent> <groupId>com.example</groupId> <artifactId>demo</artifactId> <version>1.0-SNAPSHOT</version> <repositories> <repository> <id>spring-snapshots</id> <name>Spring Snapshots</name> <url>https://repo.spring.io/snapshot</url> <snapshots> <enabled>true</enabled> </snapshots> </repository> </repositories> </project> ``` --- ###
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值