Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Dependency javax.mail:mail:1.4 not found

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!

like image 920
Anca N. Avatar asked Mar 04 '23 22:03

Anca N.


2 Answers

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.

like image 146
wemu Avatar answered Mar 16 '23 08:03

wemu


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"
like image 33
Ray Hulha Avatar answered Mar 16 '23 09:03

Ray Hulha