Spring 找不到javax.mail.internet.mimessage的类文件
我在构建项目时遇到以下错误Spring 找不到javax.mail.internet.mimessage的类文件,spring,maven,jakarta-mail,Spring,Maven,Jakarta Mail,我在构建项目时遇到以下错误 City\controller\MyMailHelper.java:59: cannot access javax.mail.internet.MimeMessage class file for javax.mail.internet.MimeMessage not found 在应用程序代码中,我指的是以下导入 import org.springframework.mail.javamail.MimeMailMessage; import org.springf
City\controller\MyMailHelper.java:59: cannot access javax.mail.internet.MimeMessage
class file for javax.mail.internet.MimeMessage not found
在应用程序代码中,我指的是以下导入
import org.springframework.mail.javamail.MimeMailMessage;
import org.springframework.mail.javamail.MimeMessageHelper;
下面给出了从我的项目的maven依赖树中获取的Spring依赖。有人能帮我确定是哪个依赖关系造成了这个问题吗
Line 27: | +- org.springframework:spring-jdbc:jar:3.2.1.RELEASE:compile (version managed from 3.2.1.RELEASE; scope managed from compile)
Line 28: | +- org.springframework:spring-orm:jar:3.2.1.RELEASE:compile (version managed from 3.2.1.RELEASE; scope managed from compile)
Line 29: | +- org.springframework:spring-jms:jar:3.2.1.RELEASE:compile (version managed from 3.2.1.RELEASE; scope managed from compile)
Line 52: | +- org.springframework:spring-beans:jar:3.2.1.RELEASE:compile (version managed from 3.2.1.RELEASE; scope managed from compile
Line 53: | +- org.springframework:spring-aop:jar:3.2.1.RELEASE:compile (version managed from 3.2.1.RELEASE; scope managed from compile)
Line 64: +- org.springframework:spring-core:jar:3.2.1.RELEASE:compile
Line 65: +- org.springframework:spring-context:jar:3.2.1.RELEASE:compile
Line 66: | \- org.springframework:spring-expression:jar:3.2.1.RELEASE:compile
Line 67: +- org.springframework:spring-web:jar:3.2.1.RELEASE:compile
Line 69: +- org.springframework:spring-webmvc:jar:3.2.1.RELEASE:compile
Line 74: | +- org.springframework.ws:spring-ws:jar:all:2.0.5.RELEASE:compile
Line 77: | +- org.springframework:spring-tx:jar:3.1.3.RELEASE:compile
Line 90: | +- org.springframework.ws:spring-ws-core:jar:2.1.2.RELEASE:compile (version managed from 2.1.2.RELEASE)
Line 91: | | +- org.springframework.ws:spring-xml:jar:2.1.2.RELEASE:compile
Line 93: | +- org.springframework:spring-oxm:jar:3.2.1.RELEASE:compile
Line 99: +- org.springframework:spring-test:jar:3.2.1.RELEASE:test
您似乎缺少对javax.mail的依赖 尝试将其添加到Maven依赖项中
<dependency>
<groupId>javax.mail</groupId>
<artifactId>mail</artifactId>
<version>1.4.7</version>
</dependency>
javax.mail
邮件
1.4.7
从repo下载工件时似乎出现了一些问题。昨天今天,当我运行mvn clean install时,它下载了一些昨天没有发生的工件。我很震惊今天没有看到任何错误。
这些工件今天从repo下载。jar带来了javax.mail:mail:jar:1.4.1当我使用SpringBoot的starter mail时,它为Spring的JavaMailSender接口提供了自动配置和启动模块。我未能在正确的gradle子项目中提供依赖项
要修复此异常,请确保提供了“libraries.springBootStarterMail”依赖项。我使用的是org.springframework.mail.javamail。多个JAR导入同一个邮件包可能会出现问题,但不确定哪些是JAR。Thx b发送,您是正确的。我在我的项目中使用它作为可传递依赖项,由于某种原因,项目的jar并没有从repo下载。今天很好用。有时候罐子装不好。。。我必须说,在花了大约一个小时试图解决这个问题之后,这给了我一个可能发生什么的线索。