[GRADLE-2794] Incorrect module version in descriptor when combining dynamic version + POM-less module Created: 13/Jun/13  Updated: 10/Nov/13  Resolved: 10/Nov/13

Status: Resolved
Project: Gradle
Affects Version/s: None
Fix Version/s: 1.10-rc-1

Type: Task
Reporter: Gradle Forums Assignee: Unassigned
Resolution: Fixed Votes: 1


For my example, I have 2 artifacts that I depend on for compile and I am using gradle 1.5. Both artifacts are stored in our Artifactory server but only artifactA has a POM, artifactB does not.


dependencies {
compile(group: 'com.test', name: 'artifactA', version: '3.18.2.+')
compile(group: 'com.test', name: 'artifactB', version: '3.18.2.+')

task dumpResolved << {
def arts = project.configurations.compile.resolvedConfiguration.resolvedArtifacts
arts.each { println "${it.moduleVersion.id.group}, ${it.moduleVersion.id.module.name}, ${it.moduleVersion.id.version}" }

Now, when I display dependencies, only the artifact with the POM, artifactA, displays the resolved version number:

$ ./gradlew dependencies
compile - Classpath for compiling the main sources.
--- com.test:artifactA:3.18.2. ->
--- com.test:artifactB:3.18.2.+

Similarly, my dumpResolved task only shows the fully resolved version number for artifactA:

$ ./gradlew dumpResolved
com.test, artifactA,
com.test, artifactB, 3.18.2.+

Why the difference in behaviour? Is there a way to make my dumpResolved task work without POMs?

Comment by Gradle Forums [ 13/Jun/13 ]

I should add that when I run a build, both dependencies are resolved as I expect:

$ ./gradlew build
Download http://artifactory:8081/artifactory/test-local/com/test/artifactA/
Download http://artifactory:8081/artifactory/test-local/com/test/artifactB/
:processResources UP-TO-DATE
:compileTestJava UP-TO-DATE
:processTestResources UP-TO-DATE
:testClasses UP-TO-DATE


Comment by Gradle Forums [ 13/Jun/13 ]

Hi Chris
This looks like a bug in the way we generate a module descriptor when a dynamic version is used and no module metadata file is found. I'll raise it in Jira.
Thanks for reporting

Comment by Daz DeBoer [ 14/Jun/13 ]

It looks like we should be using descriptor.getResolvedModuleRevisionId() instead of descriptor.getModuleRevisionId() [here](https://github.com/gradle/gradle/blob/master/subprojects/core-impl/src/main/groovy/org/gradle/api/internal/artifacts/ivyservice/ivyresolve/DefaultBuildableModuleVersionMetaDataResolveResult.java#L46).

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