[GRADLE-2204] Tooling API: Expose dependencies from the custom configuraiton Created: 30/Mar/12  Updated: 04/Jan/13  Resolved: 24/Apr/12

Status: Resolved
Project: Gradle
Affects Version/s: 1.0-milestone-9
Fix Version/s: None

Type: Bug
Reporter: Denis Zhdanov Assignee: Szczepan Faber
Resolution: Not A Bug Votes: 0


 Description   

The API should provide information about dependency from the custom configurations.

Example

  1. Consider the following project - https://github.com/mlusetti/tapestry-security-example;
  2. Execute the following program against it:
    package org.jetbrains.plugins.gradle;
    
    import org.gradle.tooling.*;
    import org.gradle.tooling.model.idea.*;
    
    import java.io.File;
    import java.util.Date;
    
    /**
     * @author Denis Zhdanov
     * @since 12/8/11 5:07 PM
     */
    public class GradleStartClass {
    
      private static final String GRADLE_TO_USE = "/home/denis/dev/gradle/gradle-1.0-milestone-9";
      private static final String GRADLE_PROJECT_PATH = "/home/denis/Downloads/tapestry-security-example";
    
      public static void main(String[] args) throws InterruptedException {
        showDependencies();
      }
    
      
      private static void showDependencies() {
        GradleConnector connector = GradleConnector.newConnector();
        connector.useInstallation(new File(GRADLE_TO_USE));
        connector.forProjectDirectory(new File(GRADLE_PROJECT_PATH));
        ProjectConnection connection = connector.connect();
        ModelBuilder<? extends IdeaProject> modelBuilder = connection.model(IdeaProject.class);
        modelBuilder.setJavaHome(new File("/home/denis/dev/jdk/jdk1.6.0_26"));
        modelBuilder.addProgressListener(new ProgressListener() {
          @Override
          public void statusChanged(ProgressEvent event) {
            //System.out.println(new Date() + ": got status change update: " + event.getDescription());
          }
        });
        System.out.println(new Date() + ": Starting project resolve");
        IdeaProject project = modelBuilder.get();
        System.out.println(new Date() + ": Project resolve is complete");
        System.out.println("-----------------> Listing modules <----------------");
        for (IdeaModule module : project.getModules()) {
          System.out.printf("    -----------------> Module %s <----------------%n", module.getName());
          for (IdeaDependency dependency : module.getDependencies()) {
            System.out.printf("Dependency: %s, scope: %s%n", dependency, dependency.getScope());
          }
        }
        System.out.println("-----------------> Finishing <----------------");
      }
    }
    
  3. The output looks like below:
    13:40:57.542 [main] DEBUG org.gradle.tooling.GradleConnector - Connecting from tooling API consumer version 1.0-milestone-9
    Fri Mar 30 13:40:57 MSD 2012: Starting project resolve
    13:40:57.603 [Connection worker] DEBUG o.g.t.i.c.l.DefaultToolingImplementationLoader - Using tooling provider from Gradle installation '/home/denis/dev/gradle/gradle-1.0-milestone-9'
    13:40:57.604 [Connection worker] DEBUG o.g.t.i.c.l.DefaultToolingImplementationLoader - Using tooling provider classpath: [/home/denis/dev/gradle/gradle-1.0-milestone-9/lib/gradle-tooling-api-1.0-milestone-9.jar, /home/denis/dev/gradle/gradle-1.0-milestone-9/lib/dom4j-1.6.1.jar, /home/denis/dev/gradle/gradle-1.0-milestone-9/lib/gradle-base-services-1.0-milestone-9.jar, /home/denis/dev/gradle/gradle-1.0-milestone-9/lib/jansi-1.2.1.jar, /home/denis/dev/gradle/gradle-1.0-milestone-9/lib/gradle-ui-1.0-milestone-9.jar, /home/denis/dev/gradle/gradle-1.0-milestone-9/lib/commons-lang-2.6.jar, /home/denis/dev/gradle/gradle-1.0-milestone-9/lib/gradle-cli-1.0-milestone-9.jar, /home/denis/dev/gradle/gradle-1.0-milestone-9/lib/jsch-0.1.46.jar, /home/denis/dev/gradle/gradle-1.0-milestone-9/lib/logback-classic-1.0.0.jar, /home/denis/dev/gradle/gradle-1.0-milestone-9/lib/groovy-all-1.8.6.jar, /home/denis/dev/gradle/gradle-1.0-milestone-9/lib/gradle-core-1.0-milestone-9.jar, /home/denis/dev/gradle/gradle-1.0-milestone-9/lib/gradle-open-api-1.0-milestone-9.jar, /home/denis/dev/gradle/gradle-1.0-milestone-9/lib/gradle-wrapper-1.0-milestone-9.jar, /home/denis/dev/gradle/gradle-1.0-milestone-9/lib/slf4j-api-1.6.4.jar, /home/denis/dev/gradle/gradle-1.0-milestone-9/lib/jna-3.2.7.jar, /home/denis/dev/gradle/gradle-1.0-milestone-9/lib/ivy-2.2.0.jar, /home/denis/dev/gradle/gradle-1.0-milestone-9/lib/asm-all-3.3.1.jar, /home/denis/dev/gradle/gradle-1.0-milestone-9/lib/guava-11.0.1.jar, /home/denis/dev/gradle/gradle-1.0-milestone-9/lib/logback-core-1.0.0.jar, /home/denis/dev/gradle/gradle-1.0-milestone-9/lib/ant-launcher-1.8.2.jar, /home/denis/dev/gradle/gradle-1.0-milestone-9/lib/commons-collections-3.2.1.jar, /home/denis/dev/gradle/gradle-1.0-milestone-9/lib/ant-1.8.2.jar, /home/denis/dev/gradle/gradle-1.0-milestone-9/lib/jna-posix-1.0.3.jar, /home/denis/dev/gradle/gradle-1.0-milestone-9/lib/gradle-launcher-1.0-milestone-9.jar, /home/denis/dev/gradle/gradle-1.0-milestone-9/lib/jaxen-1.1.jar, /home/denis/dev/gradle/gradle-1.0-milestone-9/lib/log4j-over-slf4j-1.6.4.jar, /home/denis/dev/gradle/gradle-1.0-milestone-9/lib/jul-to-slf4j-1.6.4.jar, /home/denis/dev/gradle/gradle-1.0-milestone-9/lib/commons-io-1.4.jar, /home/denis/dev/gradle/gradle-1.0-milestone-9/lib/jcl-over-slf4j-1.6.4.jar, /home/denis/dev/gradle/gradle-1.0-milestone-9/lib/gradle-native-1.0-milestone-9.jar, /home/denis/dev/gradle/gradle-1.0-milestone-9/lib/jcip-annotations-1.0.jar]
    13:40:57.698 [Connection worker] DEBUG o.g.t.i.provider.DefaultConnection - Provider implementation created.
    13:40:57.772 [Connection worker] INFO  o.g.t.i.provider.DefaultConnection - Tooling API uses target gradle version: 1.0-milestone-9.
    13:40:57.776 [Connection worker] DEBUG o.g.l.i.SingleOpLoggingConfigurer - Single-op logging configuration; configurer id: 618872344, log level: INFO
    Connected to the daemon. Dispatching Build{id=1333100457999-1, currentDir=/home/denis/work/ultimate} request.
    
    BUILD SUCCESSFUL
    
    Total time: 0.896 secs
    Fri Mar 30 13:40:58 MSD 2012: Project resolve is complete
    -----------------> Listing modules <----------------
        -----------------> Module tapestry-security-example <----------------
    Dependency: IdeaLibraryDependency{file=/home/denis/.gradle/caches/artifacts-8/filestore/org.apache.tapestry/tapestry-core/5.3.2/jar/8c4e471736143f64d3bb51de2cc17aea1d38f91d/tapestry-core-5.3.2.jar, source=/home/denis/.gradle/caches/artifacts-8/filestore/org.apache.tapestry/tapestry-core/5.3.2/source/bd6d6414070f7612230a85876eaa39517097ddea/tapestry-core-5.3.2-sources.jar, javadoc=null, exported=true, scope='IdeaDependencyScope{scope='COMPILE'}'}, scope: IdeaDependencyScope{scope='COMPILE'}
    Dependency: IdeaLibraryDependency{file=/home/denis/.gradle/caches/artifacts-8/filestore/org.apache.tapestry/tapestry-yuicompressor/5.3.2/jar/9293eb2ac8a16fc7177ac05bb307fb8a5979b363/tapestry-yuicompressor-5.3.2.jar, source=/home/denis/.gradle/caches/artifacts-8/filestore/org.apache.tapestry/tapestry-yuicompressor/5.3.2/source/e50694d9f03fae87efcacf4754db491aba699cf1/tapestry-yuicompressor-5.3.2-sources.jar, javadoc=null, exported=true, scope='IdeaDependencyScope{scope='COMPILE'}'}, scope: IdeaDependencyScope{scope='COMPILE'}
    Dependency: IdeaLibraryDependency{file=/home/denis/.gradle/caches/artifacts-8/filestore/org.tynamo/tapestry-security/0.4.3/jar/467a13fd3edabd496d3c393c1fb48725538f41f1/tapestry-security-0.4.3.jar, source=/home/denis/.gradle/caches/artifacts-8/filestore/org.tynamo/tapestry-security/0.4.3/source/98e2e00dd99bcd7cf6895e5351483cdcea9899cf/tapestry-security-0.4.3-sources.jar, javadoc=null, exported=true, scope='IdeaDependencyScope{scope='COMPILE'}'}, scope: IdeaDependencyScope{scope='COMPILE'}
    Dependency: IdeaLibraryDependency{file=/home/denis/.gradle/caches/artifacts-8/filestore/org.apache.shiro/shiro-core/1.2.0/bundle/6c071fe5b33b919051b612b43dd522340cc38fc5/shiro-core-1.2.0.jar, source=/home/denis/.gradle/caches/artifacts-8/filestore/org.apache.shiro/shiro-core/1.2.0/source/8a88dd8223f9b8d2e8441bb683add0f79d8a22e5/shiro-core-1.2.0-sources.jar, javadoc=null, exported=true, scope='IdeaDependencyScope{scope='COMPILE'}'}, scope: IdeaDependencyScope{scope='COMPILE'}
    Dependency: IdeaLibraryDependency{file=/home/denis/.gradle/caches/artifacts-8/filestore/antlr/antlr/2.7.7/jar/83cd2cd674a217ade95a4bb83a8a14f351f48bd0/antlr-2.7.7.jar, source=null, javadoc=null, exported=true, scope='IdeaDependencyScope{scope='COMPILE'}'}, scope: IdeaDependencyScope{scope='COMPILE'}
    Dependency: IdeaLibraryDependency{file=/home/denis/.gradle/caches/artifacts-8/filestore/org.antlr/stringtemplate/3.2.1/jar/59ec8083721eae215c6f3caee944c410d2be34de/stringtemplate-3.2.1.jar, source=/home/denis/.gradle/caches/artifacts-8/filestore/org.antlr/stringtemplate/3.2.1/source/105785687b0c85a7f70cddfdc3a391bcab121872/stringtemplate-3.2.1-sources.jar, javadoc=null, exported=true, scope='IdeaDependencyScope{scope='COMPILE'}'}, scope: IdeaDependencyScope{scope='COMPILE'}
    Dependency: IdeaLibraryDependency{file=/home/denis/.gradle/caches/artifacts-8/filestore/org.antlr/antlr-runtime/3.3/jar/ccd65b08cbc9b7e90b9facd4d125a133c6f87228/antlr-runtime-3.3.jar, source=/home/denis/.gradle/caches/artifacts-8/filestore/org.antlr/antlr-runtime/3.3/source/544a3068dcf34883f6e512af91407f110522887e/antlr-runtime-3.3-sources.jar, javadoc=null, exported=true, scope='IdeaDependencyScope{scope='COMPILE'}'}, scope: IdeaDependencyScope{scope='COMPILE'}
    Dependency: IdeaLibraryDependency{file=/home/denis/.gradle/caches/artifacts-8/filestore/commons-codec/commons-codec/1.5/jar/cf993e250ff71804754ec2734a16f23c0be99f70/commons-codec-1.5.jar, source=/home/denis/.gradle/caches/artifacts-8/filestore/commons-codec/commons-codec/1.5/source/1100638866461d41fbed0e89d722b161c579fe23/commons-codec-1.5-sources.jar, javadoc=null, exported=true, scope='IdeaDependencyScope{scope='COMPILE'}'}, scope: IdeaDependencyScope{scope='COMPILE'}
    Dependency: IdeaLibraryDependency{file=/home/denis/.gradle/caches/artifacts-8/filestore/org.apache.tapestry/tapestry-json/5.3.2/jar/7223ee5a3816b881ee99ccbce9927695a9ead463/tapestry-json-5.3.2.jar, source=/home/denis/.gradle/caches/artifacts-8/filestore/org.apache.tapestry/tapestry-json/5.3.2/source/52985a1df83de908aa678914887e7b2412b8962a/tapestry-json-5.3.2-sources.jar, javadoc=null, exported=true, scope='IdeaDependencyScope{scope='COMPILE'}'}, scope: IdeaDependencyScope{scope='COMPILE'}
    Dependency: IdeaLibraryDependency{file=/home/denis/.gradle/caches/artifacts-8/filestore/org.slf4j/slf4j-api/1.6.4/jar/2396d74b12b905f780ed7966738bb78438e8371a/slf4j-api-1.6.4.jar, source=/home/denis/.gradle/caches/artifacts-8/filestore/org.slf4j/slf4j-api/1.6.4/source/a045ecb292c2b2559e8e9778303a08c91f537c68/slf4j-api-1.6.4-sources.jar, javadoc=null, exported=true, scope='IdeaDependencyScope{scope='COMPILE'}'}, scope: IdeaDependencyScope{scope='COMPILE'}
    Dependency: IdeaLibraryDependency{file=/home/denis/.gradle/caches/artifacts-8/filestore/org.apache.tapestry/plastic/5.3.2/jar/da1463d79f579280d02e09fac5911517a1509ce3/plastic-5.3.2.jar, source=/home/denis/.gradle/caches/artifacts-8/filestore/org.apache.tapestry/plastic/5.3.2/source/7802f27a5f2a158f03aaf17c43ce80aee3712193/plastic-5.3.2-sources.jar, javadoc=null, exported=true, scope='IdeaDependencyScope{scope='COMPILE'}'}, scope: IdeaDependencyScope{scope='COMPILE'}
    Dependency: IdeaLibraryDependency{file=/home/denis/.gradle/caches/artifacts-8/filestore/log4j/log4j/1.2.16/bundle/7999a63bfccbc7c247a9aea10d83d4272bd492c6/log4j-1.2.16.jar, source=/home/denis/.gradle/caches/artifacts-8/filestore/log4j/log4j/1.2.16/source/bf945d1dc995be7fe64923625f842fbb6bf443be/log4j-1.2.16-sources.jar, javadoc=null, exported=true, scope='IdeaDependencyScope{scope='COMPILE'}'}, scope: IdeaDependencyScope{scope='COMPILE'}
    Dependency: IdeaLibraryDependency{file=/home/denis/.gradle/caches/artifacts-8/filestore/org.slf4j/slf4j-log4j12/1.6.1/jar/bd245d6746cdd4e6203e976e21d597a46f115802/slf4j-log4j12-1.6.1.jar, source=/home/denis/.gradle/caches/artifacts-8/filestore/org.slf4j/slf4j-log4j12/1.6.1/source/7a26b08b265f55622fa1fed3bda68bbd37a465ba/slf4j-log4j12-1.6.1-sources.jar, javadoc=null, exported=true, scope='IdeaDependencyScope{scope='COMPILE'}'}, scope: IdeaDependencyScope{scope='COMPILE'}
    Dependency: IdeaLibraryDependency{file=/home/denis/.gradle/caches/artifacts-8/filestore/javax.inject/javax.inject/1/jar/6975da39a7040257bd51d21a231b76c915872d38/javax.inject-1.jar, source=/home/denis/.gradle/caches/artifacts-8/filestore/javax.inject/javax.inject/1/source/a00123f261762a7c5e0ec916a2c7c8298d29c400/javax.inject-1-sources.jar, javadoc=null, exported=true, scope='IdeaDependencyScope{scope='COMPILE'}'}, scope: IdeaDependencyScope{scope='COMPILE'}
    Dependency: IdeaLibraryDependency{file=/home/denis/.gradle/caches/artifacts-8/filestore/org.apache.tapestry/tapestry5-annotations/5.3.2/jar/5e6df7182de8dfd2c36b86e908f620dd4bd3e2d5/tapestry5-annotations-5.3.2.jar, source=/home/denis/.gradle/caches/artifacts-8/filestore/org.apache.tapestry/tapestry5-annotations/5.3.2/source/a77b1a54454891fd9d3760fb02593e741ce3015c/tapestry5-annotations-5.3.2-sources.jar, javadoc=null, exported=true, scope='IdeaDependencyScope{scope='COMPILE'}'}, scope: IdeaDependencyScope{scope='COMPILE'}
    Dependency: IdeaLibraryDependency{file=/home/denis/.gradle/caches/artifacts-8/filestore/org.apache.tapestry/tapestry-func/5.3.2/jar/cdad284a817f226bb2e7629c64021b554b1fd461/tapestry-func-5.3.2.jar, source=/home/denis/.gradle/caches/artifacts-8/filestore/org.apache.tapestry/tapestry-func/5.3.2/source/5edfe9646ddab69b406157f25d2dba26060565eb/tapestry-func-5.3.2-sources.jar, javadoc=null, exported=true, scope='IdeaDependencyScope{scope='COMPILE'}'}, scope: IdeaDependencyScope{scope='COMPILE'}
    Dependency: IdeaLibraryDependency{file=/home/denis/.gradle/caches/artifacts-8/filestore/javassist/javassist/3.12.1.GA/jar/526633327faa61aee448a519e8a4d53ec3057885/javassist-3.12.1.GA.jar, source=/home/denis/.gradle/caches/artifacts-8/filestore/javassist/javassist/3.12.1.GA/source/cc64c85182743e0e8166cfc072a4359e54bbc7e9/javassist-3.12.1.GA-sources.jar, javadoc=null, exported=true, scope='IdeaDependencyScope{scope='COMPILE'}'}, scope: IdeaDependencyScope{scope='COMPILE'}
    Dependency: IdeaLibraryDependency{file=/home/denis/.gradle/caches/artifacts-8/filestore/org.apache.tapestry/tapestry-ioc/5.3.2/jar/35f59cf86af8df8675241a0aaa280f63100f78cc/tapestry-ioc-5.3.2.jar, source=/home/denis/.gradle/caches/artifacts-8/filestore/org.apache.tapestry/tapestry-ioc/5.3.2/source/6ec231d61dc2889a11454fe64369b5841473a663/tapestry-ioc-5.3.2-sources.jar, javadoc=null, exported=true, scope='IdeaDependencyScope{scope='COMPILE'}'}, scope: IdeaDependencyScope{scope='COMPILE'}
    Dependency: IdeaLibraryDependency{file=/home/denis/.gradle/caches/artifacts-8/filestore/rhino/js/1.6R7/jar/77e5e566457426095c743be207cba53a2391dffa/js-1.6R7.jar, source=null, javadoc=null, exported=true, scope='IdeaDependencyScope{scope='COMPILE'}'}, scope: IdeaDependencyScope{scope='COMPILE'}
    Dependency: IdeaLibraryDependency{file=/home/denis/.gradle/caches/artifacts-8/filestore/com.yahoo.platform.yui/yuicompressor/2.4.6/jar/5b8477e867040ba58b6c8a7ac6deb6da22109237/yuicompressor-2.4.6.jar, source=/home/denis/.gradle/caches/artifacts-8/filestore/com.yahoo.platform.yui/yuicompressor/2.4.6/source/e2b7e0bb58cef95f526b48e4ebb00ca933af98b9/yuicompressor-2.4.6-sources.jar, javadoc=null, exported=true, scope='IdeaDependencyScope{scope='COMPILE'}'}, scope: IdeaDependencyScope{scope='COMPILE'}
    Dependency: IdeaLibraryDependency{file=/home/denis/.gradle/caches/artifacts-8/filestore/org.apache.shiro/shiro-web/1.2.0/bundle/becdb6c72bf630f5d26417917f485a73f9f9dd1f/shiro-web-1.2.0.jar, source=/home/denis/.gradle/caches/artifacts-8/filestore/org.apache.shiro/shiro-web/1.2.0/source/4d10f20e16fc2237ff8e5837796f70aecf02e295/shiro-web-1.2.0-sources.jar, javadoc=null, exported=true, scope='IdeaDependencyScope{scope='COMPILE'}'}, scope: IdeaDependencyScope{scope='COMPILE'}
    Dependency: IdeaLibraryDependency{file=/home/denis/.gradle/caches/artifacts-8/filestore/org.tynamo/tynamo-common/0.0.1/jar/2b757702878a72854b07d70c0c5a0c7294cc34be/tynamo-common-0.0.1.jar, source=/home/denis/.gradle/caches/artifacts-8/filestore/org.tynamo/tynamo-common/0.0.1/source/8fb9a3cabaf1827daedc41becd9b761d538ab8ef/tynamo-common-0.0.1-sources.jar, javadoc=null, exported=true, scope='IdeaDependencyScope{scope='COMPILE'}'}, scope: IdeaDependencyScope{scope='COMPILE'}
    Dependency: IdeaLibraryDependency{file=/home/denis/.gradle/caches/artifacts-8/filestore/org.tynamo/tapestry-exceptionpage/0.1.2/jar/3c4f09503ae44bc5522b7f6025f0b48554dd114d/tapestry-exceptionpage-0.1.2.jar, source=/home/denis/.gradle/caches/artifacts-8/filestore/org.tynamo/tapestry-exceptionpage/0.1.2/source/bfa9c04ba816e1536add8968d0429756b72d858d/tapestry-exceptionpage-0.1.2-sources.jar, javadoc=null, exported=true, scope='IdeaDependencyScope{scope='COMPILE'}'}, scope: IdeaDependencyScope{scope='COMPILE'}
    Dependency: IdeaLibraryDependency{file=/home/denis/.gradle/caches/artifacts-8/filestore/commons-beanutils/commons-beanutils/1.8.3/jar/686ef3410bcf4ab8ce7fd0b899e832aaba5facf7/commons-beanutils-1.8.3.jar, source=/home/denis/.gradle/caches/artifacts-8/filestore/commons-beanutils/commons-beanutils/1.8.3/source/170d03db4cb48be2f8f35ce3243d62c4b2204e2e/commons-beanutils-1.8.3-sources.jar, javadoc=null, exported=true, scope='IdeaDependencyScope{scope='COMPILE'}'}, scope: IdeaDependencyScope{scope='COMPILE'}
    -----------------> Finishing <----------------
    

    Problem: 'servlet-api' dependency configured for the 'provided' configuration at the build file is not exposed by the API



 Comments   
Comment by Szczepan Faber [ 24/Apr/12 ]

Hey Denis, this is not quite a bug.

The idea plugin does not automatically take jars from the sourceSets runtime / compile classpaths. If you want to specify extra excluded/included configurations you have to use the specific idea dsl: http://gradle.org/docs/current/dsl/org.gradle.plugins.ide.idea.model.IdeaModule.html#org.gradle.plugins.ide.idea.model.IdeaModule:scopes

I'm closing this as I don't consider this as a bug. Please reopen if necessary.

Comment by Denis Zhdanov [ 02/May/12 ]

I still consider that to be a problem. However, it looks like a duplicate of the http://issues.gradle.org/browse/GRADLE-2055

Generated at Wed Jun 30 12:15:33 CDT 2021 using Jira 8.4.2#804003-sha1:d21414fc212e3af190e92c2d2ac41299b89402cf.