Maven 已经成功加载依赖,但是依然报错的解决方案

pom.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>
  <groupId>com.gxwz</groupId>
  <artifactId>lottery3</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <packaging>war</packaging>

	<build>
		<finalName>lottery</finalName>
	</build>
	<properties>
		<spring.version>5.1.5.RELEASE</spring.version>
	</properties>

	<dependencies>
		<!-- https://mvnrepository.com/artifact/org.springframework/spring-webmvc -->
		<dependency>
		    <groupId>org.springframework</groupId>
		    <artifactId>spring-webmvc</artifactId>
		    <version>${spring.version}</version>
		</dependency>
		<!-- https://mvnrepository.com/artifact/com.hynnet/jxl -->
		<dependency>
			<groupId>com.hynnet</groupId>
			<artifactId>jxl</artifactId>
			<version>2.6.12.1</version>
		</dependency>
		<!-- https://mvnrepository.com/artifact/javax.servlet/javax.servlet-api -->
		<dependency>
		    <groupId>javax.servlet</groupId>
		    <artifactId>javax.servlet-api</artifactId>
		    <version>3.1.0</version>
		    <scope>provided</scope>
		</dependency>
		<!-- https://mvnrepository.com/artifact/taglibs/standard -->
		<dependency>
		    <groupId>taglibs</groupId>
		    <artifactId>standard</artifactId>
		    <version>1.1.2</version>
		</dependency>
		<!-- https://mvnrepository.com/artifact/javax.servlet/jstl -->
		<dependency>
		    <groupId>javax.servlet</groupId>
		    <artifactId>jstl</artifactId>
		    <version>1.2</version>
		</dependency>
		<!-- https://mvnrepository.com/artifact/org.apache.poi/poi-ooxml-schemas -->
		<dependency>
			<groupId>org.apache.poi</groupId>
			<artifactId>poi-ooxml</artifactId>
			<version>3.14</version>
		</dependency>
		
	</dependencies>

</project>

项目截图

根据截图可以看到,项目已经成功加载了依赖的所有jar包了,

但是问题来了,pom.xml文件报错,显示jar包没找到。

根据测试发现,一添加org.apache.poi 的这个jar包pom.xml就会有报错。

		<!-- https://mvnrepository.com/artifact/org.apache.poi/poi-ooxml-schemas -->
		<dependency>
			<groupId>org.apache.poi</groupId>
			<artifactId>poi-ooxml</artifactId>
			<version>3.14</version>
		</dependency>

经过了半天的折腾才发现是Maven在后台执行管理jar包时出现了很多xxx.jar.lastUpdated文件。

解决方案:

在项目的Libraries-Maven Dependencies 下找到搞事情的Maven依赖包poi-xxx.ar,

鼠标右键找到该jar包在本地仓库中的具体位置

然后再把xxx.jar.lastUpdated后缀的文件全部干掉

更新Maven项目 右键项目-Maven-Update Project

更新之后报错全部消失,大功告成!

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

日月星辰TEL

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值