# Incorrect module version in descriptor when combining dynamic version + POM-less module

**URL:** <https://discuss.gradle.org/t/incorrect-module-version-in-descriptor-when-combining-dynamic-version-pom-less-module/6133>\
**Category:** Old Forum Archive\
**Created:** [May 16, 2013, 5:23pm UTC](https://discuss.gradle.org/t/incorrect-module-version-in-descriptor-when-combining-dynamic-version-pom-less-module/6133 "2013-05-16T17:23:00Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Chris\_Dore](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/chris_dore/32/7592_2.png) [@Chris\_Dore](https://discuss.gradle.org/u/Chris_Dore)\
**Post date:** [May 16, 2013, 5:23pm UTC](https://discuss.gradle.org/t/incorrect-module-version-in-descriptor-when-combining-dynamic-version-pom-less-module/6133/1 "2013-05-16T17:23:00Z")

</div>

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.

build.gradle

```gradle
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:

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

```

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

```gradle
$ ./gradlew dumpResolved
:dumpResolved
com.test, artifactA, 3.18.2.0.999
com.test, artifactB, 3.18.2.+

```

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

---

<div class="post-metadata">

**Author:** ![Chris\_Dore](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/chris_dore/32/7592_2.png) [@Chris\_Dore](https://discuss.gradle.org/u/Chris_Dore)\
**Post date:** [May 16, 2013, 5:30pm UTC](https://discuss.gradle.org/t/incorrect-module-version-in-descriptor-when-combining-dynamic-version-pom-less-module/6133/2 "2013-05-16T17:30:00Z")

</div>

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

```gradle
$ ./gradlew build
:compileJava
Download http://artifactory:8081/artifactory/test-local/com/test/artifactA/3.18.2.0.999/artifactA-3.18.2.0.999.jar
Download http://artifactory:8081/artifactory/test-local/com/test/artifactB/3.18.2.0.130/artifactB-3.18.2.0.130.jar
:processResources UP-TO-DATE
:classes
:jar
:assemble
:compileTestJava UP-TO-DATE
:processTestResources UP-TO-DATE
:testClasses UP-TO-DATE
:test
:check
:build
  BUILD SUCCESSFUL

```

---

<div class="post-metadata">

**Author:** ![daz](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/daz/32/2475_2.png) [@daz](https://discuss.gradle.org/u/daz)\
**Post date:** [June 13, 2013, 5:35pm UTC](https://discuss.gradle.org/t/incorrect-module-version-in-descriptor-when-combining-dynamic-version-pom-less-module/6133/3 "2013-06-13T17:35:00Z")

</div>

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 Daz

---

<div class="post-metadata">

**Author:** ![daz](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/daz/32/2475_2.png) [@daz](https://discuss.gradle.org/u/daz)\
**Post date:** [June 14, 2013, 4:02pm UTC](https://discuss.gradle.org/t/incorrect-module-version-in-descriptor-when-combining-dynamic-version-pom-less-module/6133/4 "2013-06-14T16:02:00Z")

</div>

If you’re interested in taking a look at fixing this, I think I’ve isolated the issue. 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).

If that works it would be a pretty trivial fix, but some integration test coverage for this issue would be good (as well as checking that the build continues to work!).

A few more pointers: [Test for resolution with metadata-less repository](https://github.com/gradle/gradle/blob/master/subprojects/core-impl/src/integTest/groovy/org/gradle/integtests/resolve/ivy/IvyDynamicRevisionRemoteResolveIntegrationTest.groovy#L93)[Code that locates jar file and builds module descriptor](https://github.com/gradle/gradle/blob/master/subprojects/core-impl/src/main/groovy/org/gradle/api/internal/artifacts/repositories/resolver/ExternalResourceResolver.java#L167)

---

<div class="post-metadata">

**Author:** ![Chris\_Dore](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/chris_dore/32/7592_2.png) [@Chris\_Dore](https://discuss.gradle.org/u/Chris_Dore)\
**Post date:** [June 15, 2013, 6:19am UTC](https://discuss.gradle.org/t/incorrect-module-version-in-descriptor-when-combining-dynamic-version-pom-less-module/6133/5 "2013-06-15T06:19:00Z")

</div>

Thanks for the pointers Daz, I will give it a go.
