如何将JAR文件添加到现有的Gradle项目

如何将JAR文件添加到现有的Gradle项目

本文介绍了如何将JAR文件添加到现有的Gradle项目?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个用于Java的 Aspose Cells for Java 的jar文件,我想将它添加到IntelliJ IDEA 2017.2.1中的现有Gradle项目中。



如果我转到查看 - >工具窗口 - > Gradle ,我会看到像这样的gradle窗口,但我不知道该点击什么。我尝试右键单击依赖关系,但没有发生任何事情。我应该点击 + 标志吗?我想不是。





我该怎么办那可以吗?


  1. 可以添加非gradle方式,即通过单击 File - > Project Structure - >依赖关系标签 - > + 标志?


  2. 我在哪里可以找到要编辑的 build.gradle 文件?我可以提前看到它的一些提交,但我很难找到围绕IDE的方式。我可以在Windows资源管理器中看到 build.gradle 文件。我应该在IDE之外手工编辑它吗?

  3. > 编译文件('/< ABSOLUTE_PATH> /< DEPENDENCY> .jar')

    //将jar文件放在项目的lib目录中。
    编译fileTree(dir:'lib',包含:['* .jar'])}


    I have a jar file for Aspose Cells for Java that I want to add to an existing Gradle project in IntelliJ IDEA 2017.2.1.

    If I go to View -> Tool Windows -> Gradle, I see the gradle window like so but I don't know what to click. I tried right-clicking on Dependencies but nothing happened. Should I click the + sign? I think not.

    How do I do that?

    1. Is it okay to add it the non-gradle way, i.e. by clicking File -> Project Structure -> Dependencies tab -> + sign?

    2. What is the gradle way of doing it? Where do I find the build.gradle file to edit? I could see it a few commits earlier but I am having a hard time finding my way around the IDE. I can see the build.gradle file in Windows explorer. Should I edit it by hand outside of the IDE?

    解决方案
    compile files('/<ABSOLUTE_PATH>/<DEPENDENCY>.jar')
    or
    //put jar file in lib directory of project.
    compile fileTree(dir: 'lib', includes: ['*.jar']) }
    

    这篇关于如何将JAR文件添加到现有的Gradle项目?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-30 07:34