Getting started: Gradle / Grails : Resolving dependencies

Hi

I'm just getting started doing my first Gradle / Grails project, so this is a newb question.

I see that IntelliJ 10 has support for gradle -- to what extent does this cover declared dependencies?

Here's what I've done:

  • Installed Grade (1.0-Milestone 1)
  • In my project -> Settings -> Gradle -> Gradle Home now points to the install location of Gradle on my machine (Is this correct?)
  • Created a build.gradle in my project root


My build.gradle looks as follows:

apply plugin: 'groovy'
version = 1.0


repositories {
    mavenCentral()
}


dependencies {
    groovy group: 'org.codehaus.groovy', name: 'groovy-all', version: '1.7.8'
    testCompile group: 'junit', name: 'junit', version: '4.8.2'
}



However, the junit dependency is not getting resolved.  What steps do I need to take to get IntelliJ downloading declared dependencies and adding them to my projects classpath?

Thanks in advance...



Marty
2 comments
Comment actions Permalink

Hello:


I just happened to notice your post and I believe that you are trying to use Gradle just like you would use Maven. In IDEA, Maven is a first class citizen and when you define dependencies, they get pulled into your $HOME/.m2 directory directly and also show up in your project after the JARs are resolved and downloaded.


To get this working with Gradle, you'll have to open 'Settings', then select 'Path Variables' in the left panel and then add a new path variable called GRADLE_REPOSITORY. Set this to your $HOME/.gradle/cache. For instance I use IDEA-10.5 with MacOS (Snow Leopard) at home and my $HOME is /Users/vkarai. Also set the path variable GRADLE_HOME to point to the location where you have Gradle installed. You may have to restart IDEA. See attached screeshot.


Hopefully this will get you going. My understanding is that Gradle will become a first class citizen in IDEA-11. I believe I read a post from Peter Gromov that said such is the case.



Attachment(s):
settings_pathvariables.png
0
Comment actions Permalink

Hi Marty,

Current feature set of the Gradle support support doesn't include dependencies management. Feel free to monitor the development progress by watching IDEA-53476.

Denis

0

Please sign in to leave a comment.