axion-release-plugin icon indicating copy to clipboard operation
axion-release-plugin copied to clipboard

Handling Versioning in Multi-Module Gradle Projects with Axion-Release Plugin

Open berkanterdogan opened this issue 1 year ago • 9 comments

I have a demo application which has libraries. It has 2 sub modules:

demo/ ->sub-demo1/ ->sub-demo2/

Their gradle configurations:

build.gradle.kts for demo

plugins {
	java
	id("pl.allegro.tech.build.axion-release") version "1.16.1"
}

subprojects {
	apply(plugin = "java")
	apply(plugin = "java-library")
	apply(plugin = "pl.allegro.tech.build.axion-release")
	
	group = "com.example"
	java.sourceCompatibility = JavaVersion.VERSION_17
	java.targetCompatibility = JavaVersion.VERSION_17


	repositories {
		mavenCentral()
	}
}

tasks.jar {
	isEnabled = false
}

build.gradle.kts for sub-demo2:


scmVersion {
    tag {
        prefix.set("sub-demo2")
        versionSeparator.set("/")

        snapshotCreator { versionFromTag, scmPosition -> "-NO_TAG" }
    }
}

version = scmVersion.version

build.gradle.kts for sub-demo1:


scmVersion {
    tag {
        prefix.set("sub-demo1")
        versionSeparator.set("/")

        snapshotCreator { versionFromTag, scmPosition -> "-NO_TAG" }
    }
}

version = scmVersion.version

Scenario:

  • Add a new commit
  • Add sub-demo1/1.0.0-SNAPSHOT and sub-demo2/2.0.0-SNAPSHOT tags to the commit above.
  • Check version with running gradle cV command: 1.0.0-SNAPSHOT for sub-demo1 and 2.0.0-SNAPSHOT for sub-demo2 -> These versions are as expected.
  • Add a new commit again and do not add new tags now.
  • Check version with running gradle cV command: 1.0.0-SNAPSHOT for sub-demo1 and 2.0.0-SNAPSHOT for sub-demo2 -> These versions are not as expected.

I am expecting the versions with -NO_TAG prefix here. My expectation is working if the project is not a multi-module project. What is the wrong for multi-module applications?

berkanterdogan avatar Jan 12 '24 13:01 berkanterdogan

Hi, I am facing the same problem. If you can help it would be greatly appreciated.. I would also be very grateful if you could fill your document with more examples.

muhammedsager11 avatar Jan 12 '24 13:01 muhammedsager11

Having the same problem, could not solve it. Could you please help on this ? Thanks

ozgurbahar avatar Jan 12 '24 14:01 ozgurbahar

I had a lot in my last issue, solved all but the snapshot problem here so closed mine and referencin. #694

However in mine the tag pushed is correct without snapshot, but then gradle publish puts -SNAPSHOT in the artifacts.

I'm not trying to change the snapshot suffix, I just don't know why it things my publish should be a snapshot when the tags exist so my issue may be related to #677

scprek avatar Jan 13 '24 23:01 scprek