[GRADLE-1706] Gradle eclipse/idea plugin breaks when dependency sources jar is not found occasionally Created: 29/Jul/11  Updated: 04/Jan/13  Resolved: 06/Oct/11

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

Type: Improvement
Reporter: Wang Liyu Assignee: Szczepan Faber
Resolution: Fixed Votes: 3

Attachments: Zip Archive TestCompileProject.zip    

 Description   

In my multi-module project, the eclipse plugin has been applied to all the module, and eclipse.classpath.downloadSources = true, when run gradle eclipse command, there are several artifacts that missing source jars in the Maven repo, then gradle keep downloading something from the repo for every module. Should add some flag to make it ignore if the source jar is missing from the repo.



 Comments   
Comment by Szczepan Faber [ 30/Jul/11 ]

Agreed. Definitely a bug, will fix it.

Comment by Szczepan Faber [ 05/Aug/11 ]

This problem can be exposed with gradle build (however, not every machine). Stack trace from the builds.gradle.org:

	  http://repo.jfrog.org/artifactory/gradle-plugins-snapshots/org.sonatype.pmaven/pmaven-groovy/0.8-20100325/pmaven-groovy-0.8-20100325-sources.jar

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

		::          UNRESOLVED DEPENDENCIES         ::

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

		:: org.sonatype.pmaven#pmaven-common;0.8-20100325: not found

		:: org.sonatype.pmaven#pmaven-groovy;0.8-20100325: not found

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



FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':maven:ideaModule'.
Cause: Could not resolve all dependencies for configuration 'detachedConfiguration5':
    - unresolved dependency: org.sonatype.pmaven#pmaven-common;0.8-20100325: not found
    - unresolved dependency: org.sonatype.pmaven#pmaven-groovy;0.8-20100325: not found

Comment by Stian L [ 08/Aug/11 ]

When I run 'gradle idea' the following entry is created in the gradle cache folder:

 Directory of C:\Users\linsti\.gradle\caches\artifacts\commons-pool\commons-pool\e76656920b0909b7437f8b467cb22b0c\sources

 08.08.2011  10:44    <DIR>          .
 08.08.2011  10:44    <DIR>          ..
 08.08.2011  10:44    <SYMLINK>      commons-pool-1.3-sources.jar  [C:\Users\linsti\.gradle\caches\artifacts\filestore\SHA
 \SHA1(commons-pool-1.3-sources.jar)]

The content of the directory the symlink points to contains this filename, but the filename seems to be incorrect (it seems like some SHA function that should have been run on the file haven't been run?).

 Directory of C:\Users\linsti\.gradle\caches\artifacts\filestore\SHA

08.08.2011  10:44    <DIR>          .
08.08.2011  10:44    <DIR>          ..
17.06.2009  02:46            57 386 SHA1(commons-pool-1.3-sources.jar)=

For some strange reason this only seem to happen with the commons-pool library.

The result is that IDEA will popup a very annoying error dialog twice on every frame activation complaining that it cannot copy the artifact to the IntelliJ local cache.

For now I've had to exclude downloading of all sources as a workaround.

Comment by Peter Niederwieser [ 11/Aug/11 ]

Haven't been able to reproduce this* with m4 and an integration test.

*the original issue, not what the previous comment describes

Comment by Peter Niederwieser [ 11/Aug/11 ]

Also tried with a multi-project build where projects reference a dependency from Maven Central for which no source Jar exists. Again, gradle eclipse worked fine. (Not saying the issue doesn't exist, just that I can't reproduce it.)

Comment by Jesper Holmberg [ 29/Aug/11 ]

I have attached an example project which fails with the following output:

:: problems summary ::
:::: WARNINGS
module not found: #springockito;1.0.0-SNAPSHOT

==== clientModule: tried

==== internal-repository: tried

==== 7lhqmligtirsqhskc7p951q46p: tried

– artifact #springockito;1.0.0-SNAPSHOT!springockito.jar(source):

C:\Program\Progress\Sonic\Workbench8.0\workspace\TestCompileProject\locallibs/springockito-1.0.0-SNAPSHOT-sources.jar

C:\Program\Progress\Sonic\Workbench8.0\workspace\TestCompileProject\locallibs/springockito-sources.jar

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

:: UNRESOLVED DEPENDENCIES ::

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

:: #springockito;1.0.0-SNAPSHOT: not found

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

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':eclipseClasspath'.
    Cause: Could not resolve all dependencies for configuration 'detachedConfiguration1':
  • unresolved dependency: #springockito;1.0.0-SNAPSHOT: not found
  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 2.125 secs

Command line: gradle eclipse

gradle -version:
------------------------------------------------------------
Gradle 1.0-milestone-4
------------------------------------------------------------

Gradle build time: den 28 juli 2011 kl 10:38 CEST
Groovy: 1.7.10
Ant: Apache Ant(TM) version 1.8.2 compiled on December 20 2010
Ivy: 2.2.0
JVM: 1.6.0_26 (Sun Microsystems Inc. 20.1-b02)
OS: Windows XP 5.1 x86

Comment by Jesper Holmberg [ 29/Aug/11 ]

Minimal project that exhibits the problem.

Comment by Carlos Rodríguez [ 07/Sep/11 ]

I got the same error while running the eclipse task on the core-imp submodule using Gradle 1.0-milestone-4:

:coreImpl:eclipseClasspath
:: problems summary ::
:::: WARNINGS
		module not found: org.sonatype.pmaven#pmaven-groovy;0.8-20100325

	==== clientModule: tried

	==== internal-repository: tried

	==== http://repo.gradle.org/gradle/libs: tried

	  http://repo.gradle.org/gradle/libs/org/sonatype/pmaven/pmaven-groovy/0.8-20100325/pmaven-groovy-0.8-20100325.pom

	  -- artifact org.sonatype.pmaven#pmaven-groovy;0.8-20100325!pmaven-groovy.jar(source):

	  http://repo.gradle.org/gradle/libs/org/sonatype/pmaven/pmaven-groovy/0.8-20100325/pmaven-groovy-0.8-20100325-sources.jar

	==== jfrog: tried

	  http://repo.jfrog.org/artifactory/gradle-plugins-snapshots/org.sonatype.pmaven/pmaven-groovy/0.8-20100325/ivy-0.8-20100325.xml

	  -- artifact org.sonatype.pmaven#pmaven-groovy;0.8-20100325!pmaven-groovy.jar(source):

	  http://repo.jfrog.org/artifactory/gradle-plugins-snapshots/org.sonatype.pmaven/pmaven-groovy/0.8-20100325/pmaven-groovy-0.8-20100325-sources.jar

		module not found: org.sonatype.pmaven#pmaven-common;0.8-20100325

	==== clientModule: tried

	==== internal-repository: tried

	==== http://repo.gradle.org/gradle/libs: tried

	  http://repo.gradle.org/gradle/libs/org/sonatype/pmaven/pmaven-common/0.8-20100325/pmaven-common-0.8-20100325.pom

	  -- artifact org.sonatype.pmaven#pmaven-common;0.8-20100325!pmaven-common.jar(source):

	  http://repo.gradle.org/gradle/libs/org/sonatype/pmaven/pmaven-common/0.8-20100325/pmaven-common-0.8-20100325-sources.jar

	==== jfrog: tried

	  http://repo.jfrog.org/artifactory/gradle-plugins-snapshots/org.sonatype.pmaven/pmaven-common/0.8-20100325/ivy-0.8-20100325.xml

	  -- artifact org.sonatype.pmaven#pmaven-common;0.8-20100325!pmaven-common.jar(source):

	  http://repo.jfrog.org/artifactory/gradle-plugins-snapshots/org.sonatype.pmaven/pmaven-common/0.8-20100325/pmaven-common-0.8-20100325-sources.jar

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

		::          UNRESOLVED DEPENDENCIES         ::

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

		:: org.sonatype.pmaven#pmaven-groovy;0.8-20100325: not found

		:: org.sonatype.pmaven#pmaven-common;0.8-20100325: not found

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



FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':coreImpl:eclipseClasspath'.
Cause: Could not resolve all dependencies for configuration 'detachedConfiguration4':
    - unresolved dependency: org.sonatype.pmaven#pmaven-groovy;0.8-20100325: not found
    - unresolved dependency: org.sonatype.pmaven#pmaven-common;0.8-20100325: not found


------------------------------------------------------------
Gradle 1.0-milestone-4
------------------------------------------------------------

Gradle build time: jueves 28 de julio de 2011 03:38:22 AM COT
Groovy: 1.7.10
Ant: Apache Ant(TM) version 1.8.2 compiled on December 20 2010
Ivy: 2.2.0
JVM: 1.6.0_20 (Sun Microsystems Inc. 19.0-b09)
OS: Linux 2.6.35-30-generic amd64

But installing gradle from the source (commit 8a1ebf3, master branch) and using it to run the eclipse task, I just got a warning:

:coreImpl:eclipseClasspath
:: problems summary ::
:::: WARNINGS
		module not found: org.sonatype.pmaven#pmaven-groovy;0.8-20100325

	==== clientModule: tried

	==== internal-repository: tried

	==== maven: tried

	  http://repo.gradle.org/gradle/libs/org/sonatype/pmaven/pmaven-groovy/0.8-20100325/pmaven-groovy-0.8-20100325.pom

	  -- artifact org.sonatype.pmaven#pmaven-groovy;0.8-20100325!pmaven-groovy.jar(source):

	  http://repo.gradle.org/gradle/libs/org/sonatype/pmaven/pmaven-groovy/0.8-20100325/pmaven-groovy-0.8-20100325-sources.jar

	==== jfrog: tried

	  http://repo.jfrog.org/artifactory/gradle-plugins-snapshots/org.sonatype.pmaven/pmaven-groovy/0.8-20100325/ivy-0.8-20100325.xml

	  -- artifact org.sonatype.pmaven#pmaven-groovy;0.8-20100325!pmaven-groovy.jar(source):

	  http://repo.jfrog.org/artifactory/gradle-plugins-snapshots/org.sonatype.pmaven/pmaven-groovy/0.8-20100325/pmaven-groovy-0.8-20100325-sources.jar

		module not found: org.sonatype.pmaven#pmaven-common;0.8-20100325

	==== clientModule: tried

	==== internal-repository: tried

	==== maven: tried

	  http://repo.gradle.org/gradle/libs/org/sonatype/pmaven/pmaven-common/0.8-20100325/pmaven-common-0.8-20100325.pom

	  -- artifact org.sonatype.pmaven#pmaven-common;0.8-20100325!pmaven-common.jar(source):

	  http://repo.gradle.org/gradle/libs/org/sonatype/pmaven/pmaven-common/0.8-20100325/pmaven-common-0.8-20100325-sources.jar

	==== jfrog: tried

	  http://repo.jfrog.org/artifactory/gradle-plugins-snapshots/org.sonatype.pmaven/pmaven-common/0.8-20100325/ivy-0.8-20100325.xml

	  -- artifact org.sonatype.pmaven#pmaven-common;0.8-20100325!pmaven-common.jar(source):

	  http://repo.jfrog.org/artifactory/gradle-plugins-snapshots/org.sonatype.pmaven/pmaven-common/0.8-20100325/pmaven-common-0.8-20100325-sources.jar

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

		::          UNRESOLVED DEPENDENCIES         ::

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

		:: org.sonatype.pmaven#pmaven-groovy;0.8-20100325: not found

		:: org.sonatype.pmaven#pmaven-common;0.8-20100325: not found

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


:coreImpl:eclipseJdt
:coreImpl:eclipseProject
:coreImpl:eclipse

BUILD SUCCESSFUL

Total time: 1 mins 19.379 secs

------------------------------------------------------------
Gradle 1.0-milestone-5-20110907220105-0500
------------------------------------------------------------

Gradle build time: miércoles 7 de septiembre de 2011 10:01:05 PM COT
Groovy: 1.7.10
Ant: Apache Ant(TM) version 1.8.2 compiled on December 20 2010
Ivy: 2.2.0
JVM: 1.6.0_20 (Sun Microsystems Inc. 19.0-b09)
OS: Linux 2.6.35-30-generic amd64

By the way, I got the same results running the eclipse task on the sample project provided by Jesper Holmberg. Does it means that this bug is fixed?

Comment by Joern Huxhorn [ 04/Oct/11 ]

I still have this issue with 1.0-m4 and a very small project at https://github.com/huxi/lbcore224 at revision 01e6acdf657fb8679cf01c51e8d5652f361b31fd.

It is using a flatDir repository and sources are simply not there.

Just add "apply plugin: 'idea'" to build.gradle.
Calling ./gradlew idea will always fail.

Comment by Joern Huxhorn [ 04/Oct/11 ]

Same for eclipse plugin.

Comment by Szczepan Faber [ 04/Oct/11 ]

This bug is fixed in master, but not in milestone-4 (see the fix version/s information).

Please let me know if you are still facing this error using latest master (or one of younger milestone-5 snapshot releases).

Hope that helps!

Comment by Szczepan Faber [ 06/Oct/11 ]

It is related GRADLE-1736. With the latest master/next gradle version the build will not break when idea cannot find sources. There might be an ivy warning printed instead but the idea metadata will be created and one can start developing using IDEA.

I'm closing this issue to avoid confusion about: is it fixed or not. If the ivy warning bothers someone please submit a separate ticket Unfortunately, the ivy warning is hard to surpress.

Comment by Szczepan Faber [ 06/Oct/11 ]

Workaround for versions < milestone-5

ideaModule.downloadSources = false

//or for all projects:
allprojects {
  ideaModule.downloadSources = false
}
Comment by Joern Huxhorn [ 08/Oct/11 ]

I can confirm that this is working with 1.0-milestone-5-20111008000006+0200.

Thanks for the infos!

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