This message was deleted.
# community-support
s
This message was deleted.
e
no, a task should not mutate project state
it's unfortunate that
version
isn't a
Property
like more modern APIs are, but you can work around that with
Copy code
version = object {
    override fun toString(): String =
        computeVersion().getArtifactVersionString()
}
during build configuration, which will be stringified to the expected value by everything using
version
, such as the
Jar
tasks and publishing
➕ 1
p
Hm, thing is that computeVersion() also reads the current project version setting before appending "-SNAPSHOT" to it. That wouldn't work there, right? Or does the above code only override the toString method of the version object?
e
it creates a whole new version. if you need to read the existing version, you need to read it before setting this object