Git Product home page Git Product logo

Comments (4)

akomakom avatar akomakom commented on June 1, 2024 1

I was able to work around this.

I was having this issue only in Kotlin builds, and not in Groovy builds.

This build.gradle works (tag is made without -SNAPSHOT):

plugins {
  id 'net.researchgate.release' version '3.0.2'
}


release {
  tagTemplate = 'v${version}'  // note: single quotes
}

But this gradle.kts does not (tag is X.X.X-SNAPSHOT):

plugins {
    id("net.researchgate.release") version "3.0.2"
}

release {
    tagTemplate.set("v${version}")  // note: double quotes
}

This seems to be a runtime interpolation issue. Once I escaped the dollar sign, things worked:

plugins {
    id("net.researchgate.release") version "3.0.2"
}

release {
    tagTemplate.set("v\${version}")
}

from gradle-release.

choesterle avatar choesterle commented on June 1, 2024

Same for me,
I have the following build.gradle

import java.time.LocalDate
import java.time.format.DateTimeFormatter

plugins {
    id 'org.springframework.boot' version '2.7.0'
    id 'io.spring.dependency-management' version '1.0.11.RELEASE'
    id 'java'
    id 'net.researchgate.release' version '3.0.2'
}

group = 'eu.lbase'
sourceCompatibility = '1.8'

repositories {
    mavenCentral()
}

dependencies {
    implementation 'org.springframework.boot:spring-boot-starter-web'
    testImplementation 'org.springframework.boot:spring-boot-starter-test'
}

test {
    useJUnitPlatform()
}

release {
    failOnCommitNeeded = false
    failOnUnversionedFiles = false
    def version = '${version}'
    def isoDate = LocalDate.now().format(DateTimeFormatter.BASIC_ISO_DATE)
    tagTemplate = "v_${version}-${isoDate}"
    git {
        requireBranch.set('')
    }
}

Now, when I start with the gradle build (v7.5.1) -->
gradlew clean build bootJar release -Prelease.useAutomaticVersion=true
I only find Snapshot jars in directory build/libs/

from gradle-release.

SerCeMan avatar SerCeMan commented on June 1, 2024

I was experiencing the same problem. However, in my case, the issue was that the version property from the .kts script was taking preference over the gradle.properties file.

from gradle-release.

madmike200590 avatar madmike200590 commented on June 1, 2024

I am experiencing the same problem, but might have a hint on where to look: It seems this behavior is connected to the tagTemplate. With only the following block in the build.gradle.kts file, everything works fine:

configure<ReleaseExtension> {
	failOnUnversionedFiles.set(false)
	with(git) {
		requireBranch.set("master")
	}
}

i.e. running gradlew release -Prelease.useAutomaticVersion=true -Prelease.releaseVersion=0.16.0 -Prelease.newVersion=0.17.0-SNAPSHOT creates a tag called 0.16.0 and changes version in gradle.properties to 0.17.0-SNAPSHOT.

However, if I add tagTemplate.set("v${version}") to build.gradle.kts and run gradlew release -Prelease.useAutomaticVersion=true -Prelease.releaseVersion=0.17.0 -Prelease.newVersion=0.18.0-SNAPSHOT, I get a tag called v0.17.0-SNAPSHOT (i.e. content of gradle.properties pre-release) and a new snapshot version 0.18.0-SNAPSHOT.

Based on some quick skimming of the code, the issue seems to be in PluginHelper#tagName():

    String tagName() {
        def engine = new SimpleTemplateEngine()
        def binding = [
            "version": project.version,
            "name"   : project.name
        ]
        return engine.createTemplate(extension.tagTemplate.get()).make(binding).toString()
    }

The property used for the tag template seems to be project.version, however, when using useAutomaticVersion in conjucntion with an explicitly set version, that version is set through property release.releaseVersion, so I guess this would have to be available to the tag template as well.

from gradle-release.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.