[GRADLE-1961] Silently fails to retrieve relocated artifacts Created: 24/Nov/11  Updated: 04/Jan/13  Resolved: 02/Feb/12

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

Type: Bug
Reporter: Blaine Simpson Assignee: Daz DeBoer
Resolution: Fixed Votes: 0

Attachments: File verifyResolve.gradle    
Issue Links:
Duplicate
Duplicates GRADLE-1973 Gradle does not report missing/failed... Resolved

 Description   

If you have a dependency on an artifact that has a relocation element in the Maven repository POM, Gradle acts as if it successfully retrieves the artifact, when it in fact retrieves nothing. This is terrible behavior that has resulted in me deploying web apps missing runtime libraries, even though the Gradle build ran without warning.

Test case dependencies.

  • 'activation:activation:1.0.2@jar',
  • 'jdom:jdom:1.1@jar'

POMs for the two dependencies above

Work-around: I guess I have to write a validator method to run after every configuration resolve, to verify that the configuration files list contains an artifact for every dependency.



 Comments   
Comment by Blaine Simpson [ 24/Nov/11 ]

I am attaching a verifier method that can be called after resolves until such point as Gradle gets fixed. Here is output from using the method on a configuration which has resolved a dependency list including the relocated activation and jdom jars.

Update: Oops. Add a couple spaces before the word "ARTIFACT" in the script. Jira won't let me update or delete the attachment.

gradlew -b tst.gradle
:d

FAILURE: Build failed with an exception.

* Where:
Build file '/home/blaine/gradle/webapp-base/tst.gradle' line: 83

* What went wrong:
Execution failed for task ':d'.
Cause: Unsatisfied dependencies for configuration 'c':
    1: jdom:jdom:1.1  ARTIFACT: jdom jar
    2: activation:activation:1.0.2  ARTIFACT: activation jar


* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debu option to get more log output.

BUILD FAILED

Total time: 5.332 secs
beyla$ 

Comment by Blaine Simpson [ 24/Nov/11 ]

Resolve verification method.

Call like

verifyResolve(configuration.c)

or

verifyResolve(configuration['c'])

Update: Sorry to keep bumping this, but this could cause frustration if not known.
Gradle swallows exceptions thrown by inline tasks, so if you do this

beaver.dependsOn << { verifyResolve(configurations.beaver) }

instead of

task namedTask << { verifyResolve(configurations.beaver) }
beaver.dependsOn << namedTask

verification failures will produce a generic message like "ERRORS a required artifact is not listed by module descriptor: *!.*". If you get that, just re-run Gradle with the -s switch to see the real message with list of failed dependencies.

Comment by Daz DeBoer [ 02/Feb/12 ]

While we still don't handle relocation directives correctly, we now complain when the artifact is not available.

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