0

I want to import this dependency:

https://mvnrepository.com/artifact/javax.mail/javax.mail-api/1.6.2

<!-- https://mvnrepository.com/artifact/javax.mail/javax.mail-api -->
<dependency>
    <groupId>javax.mail</groupId>
    <artifactId>javax.mail-api</artifactId>
    <version>1.6.2</version>
</dependency>

in my maven project from Intellij, but I get an error at artifactId and version:

Dependency 'javax.mail:javax.mail-api:1.6.2' not found
KunLun
  • 3,109
  • 3
  • 18
  • 65
  • 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. See : [https://stackoverflow.com/questions/53687816/dependency-javax-mailmail1-4-not-found] – Kubadev Oct 10 '19 at 13:37
  • You can use the non Oracle alternative [`jakarta.mail`](https://mvnrepository.com/artifact/com.sun.mail/jakarta.mail/1.6.4). Don't get confused, it is just a different name (and as well as Java is, Jakarta is an Indonesian island). – deHaar Oct 10 '19 at 13:42
  • Strange, I can get it on a Maven project. Do you have Maven installed on your system? –  Oct 10 '19 at 13:57
  • @KubNetwork version 1.6.2 is in mvnrepository.com, why don't download it? – KunLun Oct 10 '19 at 13:59
  • @EugenCovaci no – KunLun Oct 10 '19 at 13:59
  • Try to reimport Maven projects from the Maven tab. –  Oct 10 '19 at 14:01
  • Are you behind a corporate proxy? –  Oct 10 '19 at 14:03
  • @EugenCovaci no – KunLun Oct 10 '19 at 14:03
  • Can you build project from command line by Maven? – Andrey Oct 11 '19 at 06:49
  • @Andrey yes. `mvn clean install` -> `BUILD SUCCESS`, but in Intellij still appear with red at dependency. – KunLun Oct 11 '19 at 10:17
  • @Andrey hmm ... I restarted IDE and now it works(maybe because of `mvn clean install` ... interesting. Thank you! – KunLun Oct 11 '19 at 10:33

0 Answers0