Using autosuggest on dependency jars that are downloaded by Gradle

霸气de小男生 提交于 2019-12-11 08:25:39

问题


I'm pretty new to Gradle and IntelliJ and I'm trying to understand how it works [cos that's what my project uses]. I created a simple java project in Intellij IDEA with a HelloWorld class and manually added the gradle.build file along with the necessary dependencies as follows:

apply plugin: 'java'
apply plugin: 'idea'
apply plugin: 'application'

mainClassName = 'main.java.test.HelloWorld'

dependencies {
    compile  'joda-time:joda-time:2.2'
}

repositories {
    mavenLocal()
    mavenCentral()
}

jar {
    baseName = 'gradle-test'
    manifest {
        attributes 'Main-Class': 'main.java.test.HelloWorld'
    }
}

task wrapper(type: Wrapper) {
    gradleVersion = '2.2'
}

While I specified the joda-time dependency, my IntelliJ project is unaware of this library and therefore I can't use of any of the autosuggest features of IntelliJ for the joda-time library.

Could someone give me information on how I can get IntelliJ to automatically start recognizing the downloaded jars and allow me to use the auto-suggest features?
In other words,

  • where are the dependency jars downloaded ?
  • How can I have these jars to automatically be included in the class path of the project ? [Is it ok to do so ? If not, what would be your recommendation ?]

Thanks !


回答1:


I used Peter's suggestion to run gradle idea and imported the project into IntelliJ and I was able to start using the auto-suggestion features in IntelliJ.

Thanks



来源:https://stackoverflow.com/questions/26986526/using-autosuggest-on-dependency-jars-that-are-downloaded-by-gradle

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!