# How to configure version for dependencies in POM file?

**URL:** https://discuss.gradle.org/t/how-to-configure-version-for-dependencies-in-pom-file/3546
**Category:** Old Forum Archive
**Created:** [May 10, 2013, 12:43pm UTC](https://discuss.gradle.org/t/how-to-configure-version-for-dependencies-in-pom-file/3546 "2013-05-10T12:43:00Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Anders\_Brolien](https://avatars.discourse-cdn.com/v4/letter/a/f0a364/32.png) [@Anders\_Brolien](https://discuss.gradle.org/u/Anders_Brolien)
#### Post date: [May 10, 2013, 12:43pm UTC](https://discuss.gradle.org/t/how-to-configure-version-for-dependencies-in-pom-file/3546/1 "2013-05-10T12:43:00Z")

</div>

Let’s say I have two gradle modules with project dependencies between each other. Module A depends on Module B.

When building and installing A the pom file for A will include a dependency referring to B and the current version of B, let’s say 1.0.0. If I then produce a new version of B, let’s say 1.0.1 the POM file for A still refers to version 1.0.0 of B.

Is there any way to configure the dependency declaration in the POM file for A so that it would say 1.0.+?

---

<div class="post-metadata">

### Author: ![Anders\_Brolien](https://avatars.discourse-cdn.com/v4/letter/a/f0a364/32.png) [@Anders\_Brolien](https://discuss.gradle.org/u/Anders_Brolien)
#### Post date: [May 10, 2013, 6:09pm UTC](https://discuss.gradle.org/t/how-to-configure-version-for-dependencies-in-pom-file/3546/2 "2013-05-10T18:09:00Z")

</div>

I managed to find a solution to this on own:

```gradle
tasks.withType(Upload) { task ->
                task.repositories.each {repo ->
                    repo.pom.whenConfigured {pom ->
                        pom.dependencies.each {dep ->
                            if (VersionHelper.isChanging(dep.version)) {
                                def newVersion = dep.version[0..-3] + '+'
                                println "Changing pom version for artifact $dep.artifactId to $newVersion was $dep.version"
                                dep.version = newVersion
                            }
                        }
                    }
                }
            }

```

Any comments on this solution?
