通过gradle将javax.mail依赖jar添加到intellij库

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/22544249/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-13 16:23:34  来源:igfitidea点击:

Adding javax.mail dependency jar to intellij library through gradle

javaintellij-ideagradle

提问by Priyabrat Nanda

I need to include the mail-1.4.7 jar file into my intellij idea project library through gradle build. I added the compile repository name into my build.gradle file as below:

我需要通过gradle build将mail-1.4.7 jar文件包含到我的intellij idea项目库中。我将编译存储库名称添加到我的 build.gradle 文件中,如下所示:

compile 'javax.mail:mail:1.4.7'

编译'javax.mail:mail:1.4.7'

Then i ran my build and although there is no error during the build, i am unable to see the jar in my project library. I was thinking through the gradle build, the jar will be managed automatically. Not sure if i need to try something else. I also tried running gradle :cleanIdea but without success.

然后我运行了我的构建,虽然构建过程中没有错误,但我无法在我的项目库中看到 jar。我在考虑通过 gradle 构建,jar 将被自动管理。不知道我是否需要尝试别的东西。我也尝试运行 gradle :cleanIdea 但没有成功。

采纳答案by Priyabrat Nanda

Finally i was able to resolve this. I reverted all changes to start again. Followed the below steps:

最后我能够解决这个问题。我恢复了所有更改以重新开始。遵循以下步骤:

  1. Add compile 'javax.mail:mail:1.4.7'to dependencies in build.gradlefile.
  2. Run gradle buildwhich will download the jar file to put in the repositories.
  3. Run gradle cleanIdea
  4. Run gradle idea
  1. 添加compile 'javax.mail:mail:1.4.7'build.gradle文件中的依赖项。
  2. 运行gradle build这将下载 jar 文件以放入存储库。
  3. gradle cleanIdea
  4. gradle idea

This resolved all the problems with the cleanideaclearing the iml files for intellij and regenerating through gradle ideacommand.

这解决了cleanidea清除 intellij 的 iml 文件并通过gradle idea命令重新生成的所有问题。