Open arjanvlek opened 2 years ago
HI, I'm having the same problem. Using
release {
git.requireBranch = 'master'
}
Doesn't work either. The error is:
A problem occurred evaluating root project '<project-name>'.
> Cannot set readonly property: requireBranch for class: net.researchgate.release.GitAdapter$GitConfig
I faced that too, and agree that it's not normal, but the following workaround works:
release.git.requireBranch.set('master')
I faced that too, and agree that it's not normal, but the following workaround works:
release.git.requireBranch.set('master')
Thank you very much. This worked for me.
I have the same problem, but with litte different error.
release {
// ...
git {
requireBranch = 'master'
}
}
Results in the following error:
Cannot cast object 'main' with class 'java.lang.String' to class 'org.gradle.api.provider.Property'
I think that the error from @arjanvlek is related to mine, because the releaseBranch
property is declared final
and initialized in the Constructor of GitAdapter.GitConfig
. I think it would be possible to fix this error by initializing all properties of GitAdapter.GitConfig
inline, without using the Constructor.
Configuring the following beforementioned workaround in build.gradle
works for me too:
release {
// ...
git {
requireBranch.set('master')
}
}
However, this workaround is not intentional. The Gradle Documentation for Lazy Evaluation states: Note that Gradle Groovy DSL generates setter methods for each Property-typed property in a task implementation. These setter methods allow you to configure the property using the assignment (=) operator as a convenience.
Please provide a fix for the root problem, as this plugin is not conform to Gradle documentation anymore.
BTW: The documentation of this plugin in README.md is not correct anymore, as requireBranch
and other properties of git
block cannot be set anymore with assignment operator.
FYI, the problem was introduced here in this commit: https://github.com/researchgate/gradle-release/pull/356/commits/a4a29c1d3a6a61c65462de38961217b32239c588#diff-e153b6a5c5ad5979271a2f7e4b409cd2357bb11a25d1498d1e374d3cb1eabe77R39-R40
Ping @Hillkorn
It seems the following also does not work anymore
release {
git.requireBranch.set("release/.*")
}
My release just failed saying I was not on the main
branch. Event though we set the requireBranch
Strangely enough all commits and the actual release of the artifact went correctly?
I guess it's because of the final :thinking:
@Shuyinsama Your code says "release/.*" is required and not main.
We're releasing from the
development
branch to themaster
branch. The following configuration works fine in version 2.8.1 of the plugin, but breaks in 3.0.0:With version 3.0.0, we're getting the following error message:
We need to override the
requireBranch
property, because we are not releasing frommain
(or previouslymaster
) branch but fromdevelopment
. The readme indicates this is still a valid configuration setting, so I wouldn't have expected this to break.Versions I'm using:
OS version is not right, my Intel Mac is running macOS 12.4 so i don't know why it says 11.4.