[GRADLE-3092] ModuleDependency.artifact() not working with 2.0 nightly Created: 20/May/14  Updated: 10/Feb/17  Resolved: 10/Feb/17

Status: Resolved
Project: Gradle
Affects Version/s: None
Fix Version/s: None

Type: Bug
Reporter: Gradle Forums Assignee: Unassigned
Resolution: Won't Fix Votes: 1


I have dependency declaration in build file as follows:

accept('eu.plumbr:agent:' + version) {
artifact {
name = 'plumbr-test'
type = 'jar'

This works fine with gradle 1.11 and 1.12, but current 2.0 nightly gives me:

08:10:08.909 [DEBUG] [org.apache.http.impl.conn.DefaultClientConnection] Sending request: HEAD /artifactory/repo/eu/plumbr/agent/B3194/agent-B3194.jar HTTP/1.1
08:10:08.910 [DEBUG] [org.apache.http.headers] >> HEAD /artifactory/repo/eu/plumbr/agent/B3194/agent-B3194.jar HTTP/1.1
08:10:08.910 [DEBUG] [org.apache.http.headers] >> Accept-Encoding: gzip,deflate
08:10:08.911 [DEBUG] [org.apache.http.headers] >> Host: repo.plumbr.eu
08:10:08.912 [DEBUG] [org.apache.http.headers] >> Connection: Keep-Alive
08:10:08.912 [DEBUG] [org.apache.http.headers] >> User-Agent: Gradle/2.0-20140513031510+0000 (Mac OS X;10.9.2;x86_64) (Oracle Corporation;1.8.0;25.0-b70)
08:10:08.913 [DEBUG] [org.apache.http.headers] >> Authorization: Basic cGx1bWJyOi0uMEFZMz1uWkRaJA==
08:10:08.983 [DEBUG] [org.apache.http.impl.conn.DefaultClientConnection] Receiving response: HTTP/1.1 404 Not Found
08:10:08.983 [DEBUG] [org.apache.http.headers] << HTTP/1.1 404 Not Found
08:10:08.984 [DEBUG] [org.apache.http.headers] << Server: nginx/1.4.7
08:10:08.984 [DEBUG] [org.apache.http.headers] << Date: Tue, 13 May 2014 05:10:08 GMT
08:10:08.984 [DEBUG] [org.apache.http.headers] << Content-Type: text/html;charset=utf-8
08:10:08.985 [DEBUG] [org.apache.http.headers] << Content-Length: 995
08:10:08.985 [DEBUG] [org.apache.http.headers] << Connection: keep-alive
08:10:08.985 [DEBUG] [org.apache.http.headers] << X-Artifactory-Id: 6fab8db6575524e8:-5d57b9fc:145e0289e73:-8000
08:10:08.986 [DEBUG] [org.apache.http.impl.client.SystemDefaultHttpClient] Connection can be kept alive indefinitely
08:10:08.986 [DEBUG] [org.apache.http.impl.client.SystemDefaultHttpClient] Authentication succeeded
08:10:08.987 [DEBUG] [org.apache.http.impl.client.TargetAuthenticationStrategy] Caching 'basic' auth scheme for http://repo.plumbr.eu:80
08:10:08.987 [DEBUG] [org.apache.http.impl.conn.PoolingClientConnectionManager] Connection [id: 15][route: {}->http://repo.plumbr.eu] can be kept alive indefinitely
08:10:08.987 [DEBUG] [org.apache.http.impl.conn.PoolingClientConnectionManager] Connection released: [id: 15][route: {}->http://repo.plumbr.eu][total kept alive: 1; route allocated: 1 of 5; total allocated: 1 of 10]
08:10:08.988 [INFO] [org.gradle.internal.resource.transport.http.HttpClientHelper] Resource missing. [HTTP HEAD: http://repo.plumbr.eu/artifactory/repo/eu/plumbr/agent/B3194/agent-B3194.jar]
08:10:08.988 [DEBUG] [org.gradle.api.internal.artifacts.repositories.resolver.ExternalResourceResolver] No meta-data file or artifact found for module 'eu.plumbr:agent:B3194' in repository 'maven'.
08:10:08.988 [DEBUG] [org.gradle.api.internal.artifacts.ivyservice.modulecache.DefaultModuleMetaDataCache] Recording absence of module descriptor in cache: eu.plumbr:agent:B3194 [changing = false]
08:10:08.989 [DEBUG] [org.gradle.api.internal.artifacts.ivyservice.resolveengine.graph.ResolvedConfigurationDependencyGraphVisitor] Attaching :plumbr-acceptance:B3194(accept) to its parents.
08:10:08.990 [DEBUG] [org.gradle.api.internal.artifacts.ivyservice.resolveengine.oldresult.TransientConfigurationResultsBuilder] Flushing resolved configuration data in Binary store in /private/var/folders/cp/yn7c3w916551mjyjr0n80t8m0000gn/T/gradle2831932390490250168.bin. Wrote root :plumbr-acceptance:B3194:accept.
08:10:08.991 [DEBUG] [org.gradle.api.internal.artifacts.ivyservice.resolveengine.result.StreamingResolutionResultBuilder$RootFactory] Loaded resolution results (0.0 secs) from Binary store in /private/var/folders/cp/yn7c3w916551mjyjr0n80t8m0000gn/T/gradle3771921613145207079.bin (exist: true)
08:10:08.991 [QUIET] [org.gradle.api.tasks.diagnostics.DependencyReportTask_Decorated] --- eu.plumbr:agent:B3194 FAILED
08:10:08.992 [QUIET] [org.gradle.api.tasks.diagnostics.DependencyReportTask_Decorated]

So it ignores artefact name completely.

Comment by Gradle Forums [ 20/May/14 ]

Still does not work with latest nightly 2.1

Comment by Gradle Forums [ 20/May/14 ]

Where did you get this from? I'm not sure if it was ever officially supported.

Comment by Gradle Forums [ 20/May/14 ]

There is an example here: [1]http://www.gradle.org/docs/current/ds...

//configuring dependency on 'someLib' module
compile(group: 'org.myorg', name: 'someLib', version:'1.0') {
//explicitly adding the dependency artifact:
artifact {
//useful when some artifact properties unconventional
name = 'someArtifact' //artifact name different than module name
extension = 'someExt'
type = 'someType'
classifier = 'someClassifier'

and javadoc here: [2]http://www.gradle.org/docs/current/ja...
[1] http://www.gradle.org/docs/current/dsl/org.gradle.api.artifacts.dsl.DependencyHandler.html
[2] http://www.gradle.org/docs/current/javadoc/org/gradle/api/artifacts/ModuleDependency.html#artifact(groovy.lang.Closure)

Comment by Benjamin Muschko [ 15/Nov/16 ]

As announced on the Gradle blog we are planning to completely migrate issues from JIRA to GitHub.

We intend to prioritize issues that are actionable and impactful while working more closely with the community. Many of our JIRA issues are inactionable or irrelevant. We would like to request your help to ensure we can appropriately prioritize JIRA issues you’ve contributed to.

Please confirm that you still advocate for your JIRA issue before December 10th, 2016 by:

  • Checking that your issues contain requisite context, impact, behaviors, and examples as described in our published guidelines.
  • Leave a comment on the JIRA issue or open a new GitHub issue confirming that the above is complete.

We look forward to collaborating with you more closely on GitHub. Thank you for your contribution to Gradle!

Comment by Benjamin Muschko [ 10/Feb/17 ]

Thanks again for reporting this issue. We haven't heard back from you after our inquiry from November 15th. We are closing this issue now. Please create an issue on GitHub if you still feel passionate about getting it resolved.

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