pom配置中parent报错Could not find artifact com.free4lab.openapi.basic:openapi:pom:1.0.20151020-SNAPSHOT a

我的情景:

使用Maven导入maven新项目到eclips中,POM文件一直报错,鼠标放置到报错位置,弹出报错信息

Non-resolvable parent POM: Could not find artifact com.free4lab.openapi.basic:openapi:pom:1.0.20151020-SNAPSHOT and ‘parent.relativePath’ points at wrong local POM @ line 5, column 11 -> [Help 2]

 

通过下面的资料,发现,代码中少了一个父POM文件,重新拉取代码再重新导入,解决

 

参考链接: https://blog.youkuaiyun.com/Ruidu_Doer/article/details/52710138

记pom配置中parent找不到的坑

用maven管理工程是常有的事情。稍微大一点的构建,依赖多了,一个pom文件写所有依赖肯定是不现实的。这时候就有了<parent/> 节点了。然后我的某个工程中的<parent/>是这样配置的:

  <parent>
    <groupId>com.free4lab.openapi.basic</groupId>
    <artifactId>openapi</artifactId>
    <version>1.0.20151020-SNAPSHOT</version>
  </parent>
  • 1
  • 2
  • 3
  • 4
  • 5

 一切没有问题了,结果构建的时候报错:

Non-resolvable parent POM: Could not find artifact com.free4lab.openapi.basic:openapi:pom:1.0.20151020-SNAPSHOT and ‘parent.relativePath’ points at wrong local POM @ line 5, column 11 -> [Help 2]

 一脸懵,最后上网找博客(这个博客归纳得挺全的)才知道,当设置了<parent/>时,是需要有一个relative path来查找父项目的pom.xml的,而如果没有,那么默认的父项目pom.xml就在该pom.xml的父附录中。如果没有,就会根据groupId和artifactId在本地和远端maven仓库中找。很不幸,这个父pom.xml对应的工程早已没有了,所以我这里就会报错。

 找到了问题,解决方法也自然简单,在这个工程的父目录下载这个pom.xml即可。当然..将父pom.xml的内容copy过来再删了<parent/>也是….可以的。

 

 

请修复下面pom报错:未解析的依赖项: 'org.docx4j:docx4j-core:jar:6.1.2' ``` <?xml version="1.0" encoding="UTF-8"?> <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 https://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.17</version> <relativePath/> </parent> <groupId>com.xueshi</groupId> <artifactId>xueshi-official-website</artifactId> <version>0.0.1-SNAPSHOT</version> <name>xueshi-official-website</name> <description>xueshi-official-website</description> <properties> <java.version>1.8</java.version> <lombok.version>1.18.32</lombok.version> <docx4j.version>6.1.2</docx4j.version> <batik.version>1.17</batik.version> <!-- 新增Spring Boot 2.x兼容版本 --> <mybatis-spring-boot.version>2.3.1</mybatis-spring-boot.version> <pagehelper-spring-boot.version>1.4.7</pagehelper-spring-boot.version> <springdoc-openapi.version>1.7.0</springdoc-openapi.version> <fastjson2.version>2.0.51</fastjson2.version> <pdfbox.version>2.0.24</pdfbox.version> </properties> <dependencies> <!-- Spring Boot Starters (自动继承2.7.17版本) --> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-thymeleaf</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data-redis</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-test</artifactId> <scope>test</scope> </dependency> <!-- Database --> <dependency> <groupId>com.mysql</groupId> <artifactId>mysql-connector-j</artifactId> <scope>runtime</scope> </dependency> <dependency> <groupId>org.mybatis.spring.boot</groupId> <artifactId>mybatis-spring-boot-starter</artifactId> <version>${mybatis-spring-boot.version}</version> </dependency> <dependency> <groupId>com.github.pagehelper</groupId> <artifactId>pagehelper-spring-boot-starter</artifactId> <version>${pagehelper-spring-boot.version}</version> </dependency> <!-- Redis --> <dependency> <groupId>io.lettuce</groupId> <artifactId>lettuce-core</artifactId> </dependency> <!-- Utilities --> <dependency> <groupId>org.projectlombok</groupId> <artifactId>lombok</artifactId> <version>${lombok.version}</version> <scope>provided</scope> </dependency> <dependency> <groupId>com.alibaba.fastjson2</groupId> <artifactId>fastjson2</artifactId> <version>${fastjson2.version}</version> </dependency> <dependency> <groupId>org.apache.commons</groupId> <artifactId>commons-lang3</artifactId> <version>3.14.0</version> </dependency> <dependency> <groupId>commons-io</groupId> <artifactId>commons-io</artifactId> <version>2.15.1</version> </dependency> <!-- API Documentation --> <dependency> <groupId>org.springdoc</groupId> <artifactId>springdoc-openapi-ui</artifactId> <version>${springdoc-openapi.version}</version> </dependency> <!-- Document Processing --> <dependency> <groupId>org.docx4j</groupId> <artifactId>docx4j-core</artifactId> <version>${docx4j.version}</version> <exclusions> <exclusion> <groupId>javax.xml.bind</groupId> <artifactId>jaxb-api</artifactId> </exclusion> </exclusions> </dependency> <dependency> <groupId>com.github.librepdf</groupId> <artifactId>openpdf</artifactId> <version>1.3.30</version> </dependency> <dependency> <groupId>org.apache.pdfbox</groupId> <artifactId>pdfbox</artifactId> <version>${pdfbox.version}</version> </dependency> <!-- Image Processing --> <dependency> <groupId>org.apache.xmlgraphics</groupId> <artifactId>batik-transcoder</artifactId> <version>${batik.version}</version> </dependency> <dependency> <groupId>org.apache.xmlgraphics</groupId> <artifactId>batik-codec</artifactId> <version>${batik.version}</version> </dependency> </dependencies> <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>3.11.0</version> <configuration> <source>${java.version}</source> <target>${java.version}</target> <encoding>UTF-8</encoding> </configuration> </plugin> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> </plugin> </plugins> </build> </project> ```
06-04
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值