Java之JavaMail 版本(class冲突问题)

阅读更多
Maven 上有多个 JavaMail 的库。到底用哪个呢?

一、问题:
如果下载过时的库,会有与 javaee 中的库冲突的问题。


二、结论:
使用这个: https://mvnrepository.com/artifact/com.sun.mail/javax.mail



    com.sun.mail
    javax.mail
    1.5.6




三、说明:

JavaMail API from Maven

引用

I am trying to upgrade to latest Java Mail utility.

From


    javax.mail
    mail
    1.4.7


to (my Intention)


    javax.mail
    mail
    1.5.1

But I don't find 1.5.1 for mail artifact,

but I can see


    com.sun.mail
    javax.mail
    1.5.1

My Question is why group id changed and if I change the group id for 1.5.1 do I need to change all my mail implementation that is already present (package name change and any other stuff) and what is the difference between com.sun.mail vs javax.mail?





引用


The Maven coordinates changed some time ago to be compatible with the scheme described here.
The new coordinates are here.

In short:

- The groupId javax.mail is no longer used for the implementation.

- There is a new artifact at javax.mail:javax.mail-api.
   It provides the javax.mail-api.jar file. This contains the JavaMail API definitions only, suitable for compiling against.

- com.sun.mail:javax.mail contains the javax.mail.jar file, the JavaMail reference implementation jar file,
   including the SMTP, IMAP, and POP3 protocol providers.


So, you should:
- either use com.sun.mail:javax.mail for compilation and packaging/deploy;
- or use javax.mail:javax.mail-api for compilation and
  then deploy the com.sun.mail:javax.mail jar where appropriate (e.g., your Tomcat lib).














引用:

http://stackoverflow.com/a/22021656/2893073

https://java.net/projects/javamail/pages/Home





-
转载请注明
原文出处:http://lixh1986.iteye.com/blog/2323537








-

你可能感兴趣的:(javamail,maven,冲突,conflict)