如何使用maven下载JavaMail(mail.jar)和JAF(activation.jar)
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/39711001/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to download JavaMail (mail.jar) and JAF (activation.jar) using maven
提问by Bill_Data23
I want to do this tutorial https://www.tutorialspoint.com/java/java_sending_email.htmabout sending emails with java and the first line of the tutorial says that I need to download JavaMail (mail.jar)
and JAF (activation.jar)
, and I want to download those jars using maven is that possible since this popular website says that is not possible http://www.mkyong.com/maven/how-to-download-javamail-api-from-maven/,
I tried searching in the maven repository but there are too many jars with the same name
我想做这个教程https://www.tutorialspoint.com/java/java_sending_email.htm关于用 java 发送电子邮件,教程的第一行说我需要下载JavaMail (mail.jar)
和JAF (activation.jar)
,我想使用 maven 下载这些罐子这是可能的,因为这个受欢迎的网站说这是不可能的http://www.mkyong.com/maven/how-to-download-javamail-api-from-maven/,我尝试在 maven 存储库中搜索,但也有许多同名的罐子
回答by Nicolas Filotto
You simply need to add this dependency to your maven project:
您只需将此依赖项添加到您的 Maven 项目中:
<dependency>
<groupId>com.sun.mail</groupId>
<artifactId>javax.mail</artifactId>
<version>1.5.6</version>
</dependency>
No need to add activation
too (unless you want to use a specific version) as it is already a dependency of javax.mail
such that it will be added as dependency to your project by transitivity.
无需添加activation
太多(除非您想使用特定版本),因为它已经是一个依赖项javax.mail
,因此它将通过传递性作为依赖项添加到您的项目中。
You can find all the artifacts' description in the home pageof the javamail
project.
您可以在项目的主页中找到所有工件的描述javamail
。
回答by RITZ XAVI
Use the following links to get the required artifacts from the maven central repository:
https://mvnrepository.com/artifact/javax.mail/mail/1.4
https://mvnrepository.com/artifact/javax.activation/activation/1.1.1
使用以下链接从 maven 中央存储库获取所需的工件:
https: //mvnrepository.com/artifact/javax.mail/mail/1.4
https://mvnrepository.com/artifact/javax.activation/activation/1.1。 1
Or
或者
Add these to your pom.xml.
将这些添加到您的 pom.xml。
<dependency>
<groupId>javax.mail</groupId>
<artifactId>mail</artifactId>
<version>1.4</version>
</dependency>
<dependency>
<groupId>javax.activation</groupId>
<artifactId>activation</artifactId>
<version>1.1.1</version>
</dependency>
回答by Arjun Chaudhary
For people who want the jar file and also the source code for debugging purpose. Download directly from the JavaMail project website.
对于需要 jar 文件以及用于调试目的的源代码的人。直接从 JavaMail 项目网站下载。