malejpavouk
malejpavouk

Reputation: 4445

Gradle subproject versioning

We are currently migrating our project from maven to gradle. Our setup looks like this:

All these maven subprojects are independently versioned

With Maven, we are using version plugin, which ensures that we set (using the plugin) version of for example subproject 1, the new version is propagated to the whole subtree (and respective dependencies in 2 and 3 are changed as well).

I was looking to docs of gradle release plugin bud was not able to find a mention about this functinality. Does it support it, or is there any other plugin, which does?

Second question, as we are in the middle of the maven-gradle migration, is it possible to combine somehow maven version plugin with any such gradle plugin? (Have 1 versioned in maven, 2 and 3 in gradle and still achieve the behavior). My guess is not, but just asking, if someone have not found some solution :-), so we do not have to do maven -> gradle in one big bang.

Thanks in advance!

Upvotes: 3

Views: 3158

Answers (1)

lance-java
lance-java

Reputation: 28061

I like to keep my version in a separate text file

root/build.gradle

def versionTxt = file('version.txt').text.trim()
allprojects {
    version = versionTxt
}

Then you can just tweak version.txt to increment the version... this separation is great eg you can do a file history on version.txt and see the version changes isolated from gradle changes.

Single project example here

Upvotes: 7

Related Questions