Gradle

  • Log In Access more options
    • Online Help
    • Keyboard Shortcuts
    • About JIRA
    • JIRA Credits
    • What’s New
  • Dashboards Access more options (Alt+d)
  • Projects Access more options (Alt+p)
  • Issues Access more options (Alt+i)
To raise new issues or bugs against Gradle, please use forums.gradle.org.
  • Gradle
  • GRADLE-1995

Tooling API: Allow to explicitly retrieve information about unresolved dependencies

  • Log In
  • Views
    • XML
    • Word
    • Printable

Details

  • Type: Bug Bug
  • Status: Open Open
  • Resolution: Unresolved
  • Affects Version/s: 1.0-milestone-6
  • Fix Version/s: None

Description

The Tooling API doesn't allow to get information about unresolved third-party dependencies. Here is a simple test that illustrates that:

  1. Go to $GRADLE_HOME/samples/java/quickstart;
  2. Define, say, version '10.2' for 'commons-collections' dependency at 'build.gradle' there;
  3. Start the program below:
    package org.jetbrains.plugins.gradle;
    
    import org.gradle.tooling.GradleConnector;
    import org.gradle.tooling.ModelBuilder;
    import org.gradle.tooling.ProjectConnection;
    import org.gradle.tooling.model.idea.*;
    
    import java.io.File;
    
    /**
     * @author Denis Zhdanov
     * @since 12/8/11 5:07 PM
     */
    public class GradleStartClass {
    
      private static final String GRADLE_PROJECT_PATH = "/home/denis/dev/gradle/gradle-1.0-milestone-6/samples/java/quickstart";
    
      public static void main(String[] args) {
        test("/home/denis/dev/gradle/gradle-1.0-milestone-6"); // Don't expect exception here
      }
    
      private static void test(String gradleHome) {
        GradleConnector connector = GradleConnector.newConnector();
        connector.useInstallation(new File(gradleHome));
        connector.forProjectDirectory(new File(GRADLE_PROJECT_PATH));
        ProjectConnection connection = connector.connect();
        ModelBuilder<? extends IdeaProject> modelBuilder = connection.model(IdeaProject.class);
        IdeaProject project = modelBuilder.get();
        for (IdeaModule module : project.getModules()) {
          for (IdeaDependency dependency : module.getDependencies()) {
            if (dependency instanceof IdeaModuleDependency) {
              continue;
            }
            System.out.printf("Dependency: %s%n", ((IdeaSingleEntryLibraryDependency)dependency).getFile());
          }
        }
      }
    }

Output:

Dependency: unresolved dependency - commons-collections#commons-collections;10.2
Dependency: /home/denis/.gradle/caches/artifacts-4/junit/junit/c12498cf18507aa6433a94eb7d3e77d5/jars/junit-4.10.jar
Dependency: /home/denis/.gradle/caches/artifacts-4/org.hamcrest/hamcrest-core/c12498cf18507aa6433a94eb7d3e77d5/jars/hamcrest-core-1.1.jar

Activity

Ascending order - Click to sort in descending order
  • All
  • Comments
  • History
  • Activity
  • TeamCity
  • Commits
  • Source
  • Reviews
Hide
Permalink
Szczepan Faber added a comment - 16/Jan/12 7:36 PM

What do you mean explictly? If the dependency type has a flag isResolved() (or something like that, e.g. information about the resolution result) is it good enough?

Show
Szczepan Faber added a comment - 16/Jan/12 7:36 PM What do you mean explictly? If the dependency type has a flag isResolved() (or something like that, e.g. information about the resolution result) is it good enough?
Hide
Permalink
Denis Zhdanov added a comment - 16/Jan/12 10:07 PM

Yes, that would be sufficient

Show
Denis Zhdanov added a comment - 16/Jan/12 10:07 PM Yes, that would be sufficient
Adam Murdoch made changes - 07/Mar/12 4:46 PM
Field Original Value New Value
Component/s Idea [ 10024 ]
Component/s IDE integration [ 10015 ]
Luke Daley made changes - 03/Jan/13 5:09 AM
Workflow jira with pivotal tracker [ 15151 ] jira with pivotal tracker (no resolved, only closed) [ 18586 ]
Luke Daley made changes - 04/Jan/13 5:10 AM
Workflow jira with pivotal tracker (no resolved, only closed) [ 18586 ] Copy of jira with pivotal tracker (no closed, only resolved) [ 21188 ]
Hide
Permalink
Denis Zhdanov added a comment - 22/Jan/13 1:46 AM

I see that gradle-1.4-rc-2 mentions the following at the release notes:

'With earlier versions of Gradle, it was not possible to generate a dependency resolution report if one of the dependencies could not be resolved. This has been rectified. Not only will the dependency resolution reports run successfully if a dependency cannot be resolved, the reports will now include details of those dependencies that couldn't be resolved.'

However, that is information is still unavailable via the tooling api.

Show
Denis Zhdanov added a comment - 22/Jan/13 1:46 AM I see that gradle-1.4-rc-2 mentions the following at the release notes: 'With earlier versions of Gradle, it was not possible to generate a dependency resolution report if one of the dependencies could not be resolved. This has been rectified. Not only will the dependency resolution reports run successfully if a dependency cannot be resolved, the reports will now include details of those dependencies that couldn't be resolved.' However, that is information is still unavailable via the tooling api.
Hide
Permalink
Szczepan Faber added a comment - 25/Jan/13 9:21 AM

Correct. We'll fix it at some point. Thanks for being patient!

Show
Szczepan Faber added a comment - 25/Jan/13 9:21 AM Correct. We'll fix it at some point. Thanks for being patient!
Unable to get TeamCity builds: No active plugin license is found! Please visit http://stiltsoft.com/teamcity for details

People

  • Assignee:
    Unassigned
    Reporter:
    Denis Zhdanov
Vote (0)
Watch (2)

Dates

  • Created:
    12/Dec/11 8:15 AM
    Updated:
    25/Jan/13 9:21 AM
  • Atlassian JIRA (v5.0.3#729-sha1:bf569e4)
  • Report a problem
  • Powered by a free Atlassian JIRA open source license for Gradle. Try JIRA - bug tracking software for your team.