0

I need my artifact to be built with project.version equals to snapshot git based version.

For example, default version after clean build or idea build: 0.2-dev.#hash

I need: 1.1-SNAPSHOT where 1.1 is from git tag, like when I run snapshot task

I tried to change ReleasePluginExtension.groovy:

release {
    defaultVersionStrategy = Strategies.SNAPSHOT
}

And

release {
    versionStrategy(Strategies.SNAPSHOT)
}

Doesn't work

My current workaround to set project.version inside by build.gradle like in library code - create object of snapshot strategy and call #version() method:

release {
    def gitRoot = project.hasProperty('git.root') ? project.property('git.root') : project.rootProject.projectDir
    def git = Grgit.open(dir: gitRoot)
    project.version = Strategies.SNAPSHOT.infer(project, git).version()
}

But i think it should be customizable by nebula-plugin.

Artem Ptushkin
  • 1,151
  • 9
  • 17

1 Answers1

1

Maybe it's been solved. Similar setting works for us with version "15.0.2", but it has to follow the plugins block directly:

release {
  defaultVersionStrategy = nebula.plugin.release.git.opinion.Strategies.SNAPSHOT
}

Latest working combination:

  • nebula.release 16.0.0
  • gradle 7.3.3
  • springboot 2.7.0

Not working anymore with gradle 7.4+

dobedo
  • 135
  • 10