[GRADLE-1157] 'eclipseClasspath' task failed in Gradle-0.9-rc-1 when using client module dependencies + flatDir repo Created: 22/Sep/10  Updated: 04/Jan/13  Resolved: 11/Aug/11

Status: Resolved
Project: Gradle
Affects Version/s: 0.9
Fix Version/s: 1.0-milestone-5

Type: Bug
Reporter: Teo Hui Ming Assignee: Peter Niederwieser
Resolution: Fixed Votes: 4


 Description   

Hi,

I'm using flat directory repository (store all .jar in
$PROJECT_HOME/lib/) and define jar dependencies explicitly in
build.gradle using client module dependencies.

Here's an example:

build.gradle:

apply plugin: 'java'
apply plugin: 'eclipse'

repositories {
       flatDir dirs: ["${gradle.gradleHomeDir}/lib"]
}

dependencies {
       compile module(':ant-launcher:1.8.1') {
               dependency ':ant:1.8.1'
       }
}

However, Gradle-0.9-rc-1 fails to generate Eclipse .classpath file
when running task ':eclipseClasspath'. Seems like it is looking for
*-sources.jar (ant-launcher-1.8.1-sources.jar) in the flat directory
repository, which of course, does not exist.

Is this a bug or a non-compatible change introduced in Gradle-0.9-rc-1
Eclipse plugin? because afaik, it works well in Gradle-0.9-preview-3.

Failed build output:

D:\teohm-workspace\learn\gradle-plugin-eclipse-issues> gradle eclipseClasspath
The Gradle.getGradleHomeDir() method is deprecated and will be removed
in the next version of Gradle.
:eclipseClasspath
:: problems summary ::
:::: WARNINGS
module not found: #ant-launcher;1.8.1

==== clientModule: tried

==== internal-repository: tried

==== a03330958801db2c5a2d581f406fca79: tried

– artifact #ant-launcher;1.8.1!ant-launcher.jar(source):

D:\teohm-workspace\tools\gradle-0.9-rc-1\lib/ant-launcher-1.8.1-sources.jar

::::::::::::::::::::::::::::::::::::::::::::::

:: UNRESOLVED DEPENDENCIES ::

::::::::::::::::::::::::::::::::::::::::::::::

:: #ant-launcher;1.8.1: not found

::::::::::::::::::::::::::::::::::::::::::::::

FAILURE: Build failed with an exception.

  • Where:
    Build file 'D:\teohm-workspace\learn\gradle-plugin-eclipse-issues\build.gradle'
  • What went wrong:
    Execution failed for task ':eclipseClasspath'.
    Cause: Could not resolve all dependencies for configuration
    'detachedConfiguration2':
  • unresolved dependency: #ant-launcher;1.8.1: not found
  • Try:
    Run with -s or -d option to get more details. Run with -S option to
    get the full (very verbose) stacktrace.

BUILD FAILED

Total time: 4.757 secs



 Comments   
Comment by Teo Hui Ming [ 24/Sep/10 ]

Hi, turns out, the issue can be resolved by setting eclipseClasspath.downloadSources = false

So here's a working sample:

build.gradle:

 
apply plugin: 'java'
apply plugin: 'eclipse'

repositories {
       flatDir dirs: ["${gradle.gradleHomeDir}/lib"]
}

dependencies {
       compile module(':ant-launcher:1.8.1') {
               dependency ':ant:1.8.1'
       }
}

eclipseClasspath {
       downloadSources = false; // required for eclipseClasspath to work
}
Comment by Teo Hui Ming [ 24/Sep/10 ]

I will close this issue since it's not a bug.

Comment by Hans Dockter [ 29/Sep/10 ]

Thanks for reporting this. I'm reopening this issue as Gradle should not fail if sources don't exist.

Comment by Andrew Thorburn [ 29/May/11 ]

Issue 1548 (which I reported) is a duplicate of this issue. As far as I can tell, there's nothing I can do merge/resolve it?

Comment by Peter Niederwieser [ 11/Aug/11 ]

Happens for flatDir repos, irrelevant whether it's a client module dependency or regular external dependency.

Generated at Wed Jun 30 11:48:24 CDT 2021 using Jira 8.4.2#804003-sha1:d21414fc212e3af190e92c2d2ac41299b89402cf.