Compile dependency is not exposed via the tooling api

Hi,

Have a problem with the tooling api not exposing one of compile dependencies defined at the build.gradle file. A sample project can be found here - http://devnet.jetbrains.com/message/5488434#5488434. A program below illustrates the problem:

package org;

import java.io.File;

import org.gradle.tooling.GradleConnector; import org.gradle.tooling.ModelBuilder; import org.gradle.tooling.ProjectConnection; import org.gradle.tooling.model.idea.*;

public class TestClient {

private static final String PROJECT_PATH = “/home/denis/Downloads/test-web”;

private static final String GRADLE_HOME = “/home/denis/dev/gradle/gradle-1.6”;

public static void main(String[] args) throws InterruptedException {

GradleConnector connector = GradleConnector.newConnector();

connector.useInstallation(new File(GRADLE_HOME));

connector.forProjectDirectory(new File(PROJECT_PATH));

ProjectConnection connection = connector.connect();

ModelBuilder modelBuilder = connection.model(IdeaProject.class);

IdeaProject project = modelBuilder.get();

for (IdeaModule module : project.getModules()) {

System.out.println("module: " + module.getName());

for (IdeaDependency dependency : module.getDependencies()) {

if (dependency instanceof IdeaModuleDependency) {

System.out.println(" module dependency: " + ((IdeaModuleDependency)dependency).getDependencyModule().getName());

} else if (dependency instanceof IdeaSingleEntryLibraryDependency) {

System.out.println(" library dependency: " + ((IdeaSingleEntryLibraryDependency)dependency).getFile().getName());

}

}

}

connection.close();

} }

I.e. no dependency is listed here, only a single module.

I was wondering what is the status of this issue ?

Thank you in advance /Lior.

The problem is with the grails-gradle plugin, not Gradle itself.

Can you try this again. Some changes have been made to that plugin recently which should resolve this.

Thank you Luke,

I will give it a try with the latest plugin and update this post accordingly.

Thank you in advance /Lior.

Hello Luke,

Updating the grails-gradle-plugin to 2.0.0-SNAPSHOT solve this issue. For reference for others I include the complete build.gradle

buildscript {
    repositories {
  maven { url "http://repo.grails.org/grails/repo" }
    }
      dependencies {
        classpath "org.grails:grails-gradle-plugin:2.0.0-SNAPSHOT"
        classpath "org.grails:grails-bootstrap:1.3.7"
    }
}
  apply plugin: "grails"
apply plugin: "idea"
  ext {
    grailsVersion = "1.3.7"
}
  configurations {
    [compile, runtime]*.exclude group: "xml-apis", module: "xml-apis"
}
  repositories {
    mavenCentral()
    maven{ url = "http://repository.jboss.org/maven2/" }
}
  dependencies {
    compile "org.grails:grails-crud:${ext.grailsVersion}",
            "org.grails:grails-gorm:${ext.grailsVersion}",
   "com.google.guava:guava:13.0.1"
   runtime "org.slf4j:slf4j-log4j12:1.5.8",
            "org.hsqldb:hsqldb:2.2.9",
   'net.sf.ehcache:ehcache-core:1.7.1'
  }
  idea.module.iml {
    whenMerged { module ->
        module.dependencies*.exported = true
    }
}