Dependency javax.mail:mail:1.4 not found

馋奶兔 提交于 2019-12-12 20:00:55

问题


After I imported a maven project in IntelliJ IDEA, there are two errors in the pom.xml file:

"Failed to read artifact descriptor for javax.mail:mail:jar:1.4"

"Dependency javax.mail:mail:1.4 not found"

Does anyone know the reason behind these errors and how can I fix them?

Thank you and have a great day!


回答1:


Due to license restrictions the older java mail classes are not in maven central or the java.net repository. usually companies host their own maven proxy and add these classes there.

Since around version 1.4.5 the dependencies are available in the java.net repository. Some later versions are also in maven central.

All other versions need to be downloaded from the oracle website and either added to a maven proxy or to your local maven repository - for example using the dependency plugin.




回答2:


Change the pom.xml to include:

    <dependencies>
        <dependency>
            <groupId>com.sun.mail</groupId>
            <artifactId>jakarta.mail</artifactId>
            <version>1.6.3</version>
        </dependency>
    </dependencies>

Or if you have a build.gradle file in the dependencies section add:

    compile "com.sun.mail:jakarta.mail:1.6.3"


来源:https://stackoverflow.com/questions/53687816/dependency-javax-mailmail1-4-not-found

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!