grails / grails-gradle-plugin

Apache License 2.0
6 stars 9 forks source link

Do not attempt to serialize project.version in task of type Test #199

Closed ysb33r closed 1 year ago

ysb33r commented 1 year ago

This line is incorrect https://github.com/grails/grails-gradle-plugin/blob/45285f7b8cfc0d4539060a70f0552f617e91794a/src/main/groovy/org/grails/gradle/plugin/core/GrailsGradlePlugin.groovy#L407

You do the correct thing when creating the properties in buildProperties task.

Line 407 should also have the same conditional.

NOTE: This bug breaks buildscripts that apply Grails plugins and a pluging that use Grolifant 2.x.

The only workaround in such situations is to add

gradle.taskGraph.whenReady {
    project.tasks.withType(Test).configureEach {
        it.systemProperties['info.app.version'] = project.version.toString()
    }
}

or

gradle.taskGraph.whenReady {
    project.tasks.withType(Test).configureEach {
        it.systemProperties['info.app.version'] = grolifant.versionProvider.get()
    }
}