Compile dependency is not exposed via the tooling api

(denis.zhdanov) #1


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 - A program below illustrates the problem:

package org;


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());





} }

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

(l.bornshtain) #2

I was wondering what is the status of this issue ?

Thank you in advance /Lior.

(Luke Daley) #3

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.

(l.bornshtain) #4

Thank you Luke,

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

Thank you in advance /Lior.

(l.bornshtain) #5

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 "" }
      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 {
    maven{ url = "" }
  dependencies {
    compile "org.grails:grails-crud:${ext.grailsVersion}",
   runtime "org.slf4j:slf4j-log4j12:1.5.8",
  idea.module.iml {
    whenMerged { module ->
        module.dependencies*.exported = true