You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "ssheikin (via GitHub)" <gi...@apache.org> on 2025/10/07 18:16:09 UTC
[PR] Allow override pushChanges from terminal [maven-release]
ssheikin opened a new pull request, #1394:
URL: https://github.com/apache/maven-release/pull/1394
mvn release:prepare -DpushChanges
Following this checklist to help us incorporate your
contribution quickly and easily:
- [x] Your pull request should address just one issue, without pulling in other changes.
- [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
- [x] Each commit in the pull request should have a meaningful subject line and body.
Note that commits might be squashed by a maintainer on merge.
- [ ] Write unit tests that match behavioral changes, where the tests fail if the changes to the runtime are not applied.
This may not always be possible but is a best-practice.
- [ ] Run `mvn verify` to make sure basic checks pass.
A more thorough check will be performed on your pull request automatically.
- [ ] You have run the integration tests successfully (`mvn -Prun-its verify`).
If your pull request is about ~20 lines of code you don't need to sign an
[Individual Contributor License Agreement](https://www.apache.org/licenses/icla.pdf) if you are unsure
please ask on the developers list.
To make clear that you license your contribution under
the [Apache License Version 2.0, January 2004](http://www.apache.org/licenses/LICENSE-2.0)
you have to acknowledge this by using the following check-box.
- [x] I hereby declare this contribution to be licenced under the [Apache License Version 2.0, January 2004](http://www.apache.org/licenses/LICENSE-2.0)
- [ ] In any other case, please file an [Apache Individual Contributor License Agreement](https://www.apache.org/licenses/icla.pdf).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Allow override pushChanges from terminal [maven-release]
Posted by "kwin (via GitHub)" <gi...@apache.org>.
kwin commented on code in PR #1394:
URL: https://github.com/apache/maven-release/pull/1394#discussion_r2491079937
##########
maven-release-manager/src/main/java/org/apache/maven/shared/release/DefaultReleaseManager.java:
##########
@@ -118,6 +118,11 @@ private void prepare(ReleasePrepareRequest prepareRequest, ReleaseResult result)
// Create a config containing values from the session properties (ie command line properties with cli).
ReleaseUtils.copyPropertiesToReleaseDescriptor(
prepareRequest.getUserProperties(), new ReleaseDescriptorBuilder() {
+ public ReleaseDescriptorBuilder setPushChanges(boolean pushChanges) {
+ builder.setPushChanges(pushChanges);
+ return this;
+ }
+
Review Comment:
I think instead of just evaluating some magic properties we should introduce a mojo parameter (with a property) in https://github.com/apache/maven-release/blob/master/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/PrepareReleaseMojo.java. That way it is also nicely documented in https://maven.apache.org/maven-release/maven-release-plugin/prepare-mojo.html.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Allow override pushChanges from terminal [maven-release]
Posted by "ssheikin (via GitHub)" <gi...@apache.org>.
ssheikin commented on code in PR #1394:
URL: https://github.com/apache/maven-release/pull/1394#discussion_r2411506771
##########
maven-release-manager/src/main/java/org/apache/maven/shared/release/DefaultReleaseManager.java:
##########
@@ -118,6 +118,11 @@ private void prepare(ReleasePrepareRequest prepareRequest, ReleaseResult result)
// Create a config containing values from the session properties (ie command line properties with cli).
ReleaseUtils.copyPropertiesToReleaseDescriptor(
prepareRequest.getUserProperties(), new ReleaseDescriptorBuilder() {
+ public ReleaseDescriptorBuilder setPushChanges(boolean pushChanges) {
+ builder.setPushChanges(pushChanges);
+ return this;
+ }
+
Review Comment:
should other properties/methods from ReleaseDescriptorBuilder be overriden here too?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Allow override pushChanges from terminal [maven-release]
Posted by "kwin (via GitHub)" <gi...@apache.org>.
kwin commented on code in PR #1394:
URL: https://github.com/apache/maven-release/pull/1394#discussion_r2491121314
##########
maven-release-manager/src/main/java/org/apache/maven/shared/release/DefaultReleaseManager.java:
##########
@@ -118,6 +118,11 @@ private void prepare(ReleasePrepareRequest prepareRequest, ReleaseResult result)
// Create a config containing values from the session properties (ie command line properties with cli).
ReleaseUtils.copyPropertiesToReleaseDescriptor(
prepareRequest.getUserProperties(), new ReleaseDescriptorBuilder() {
+ public ReleaseDescriptorBuilder setPushChanges(boolean pushChanges) {
+ builder.setPushChanges(pushChanges);
+ return this;
+ }
+
Review Comment:
Isn't https://github.com/apache/maven-release/blob/f06aaa2f332f87e390f398785c7435aee4fa8229/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/AbstractScmReadWriteReleaseMojo.java#L104 enough in the context of the prepare goal?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Allow override pushChanges from terminal [maven-release]
Posted by "kwin (via GitHub)" <gi...@apache.org>.
kwin commented on code in PR #1394:
URL: https://github.com/apache/maven-release/pull/1394#discussion_r2491079937
##########
maven-release-manager/src/main/java/org/apache/maven/shared/release/DefaultReleaseManager.java:
##########
@@ -118,6 +118,11 @@ private void prepare(ReleasePrepareRequest prepareRequest, ReleaseResult result)
// Create a config containing values from the session properties (ie command line properties with cli).
ReleaseUtils.copyPropertiesToReleaseDescriptor(
prepareRequest.getUserProperties(), new ReleaseDescriptorBuilder() {
+ public ReleaseDescriptorBuilder setPushChanges(boolean pushChanges) {
+ builder.setPushChanges(pushChanges);
+ return this;
+ }
+
Review Comment:
I think instead of just evaluating some magic properties we should introduce a mojo parameter (with a property) in https://github.com/apache/maven-release/blob/master/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/PrepareReleaseMojo.java. That way it is also nicely documented in https://maven.apache.org/maven-release/maven-release-plugin/prepare-mojo.html.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Allow override pushChanges from terminal [maven-release]
Posted by "ssheikin (via GitHub)" <gi...@apache.org>.
ssheikin commented on code in PR #1394:
URL: https://github.com/apache/maven-release/pull/1394#discussion_r3420646244
##########
maven-release-manager/src/main/java/org/apache/maven/shared/release/DefaultReleaseManager.java:
##########
@@ -118,6 +118,11 @@ private void prepare(ReleasePrepareRequest prepareRequest, ReleaseResult result)
// Create a config containing values from the session properties (ie command line properties with cli).
ReleaseUtils.copyPropertiesToReleaseDescriptor(
prepareRequest.getUserProperties(), new ReleaseDescriptorBuilder() {
+ public ReleaseDescriptorBuilder setPushChanges(boolean pushChanges) {
+ builder.setPushChanges(pushChanges);
+ return this;
+ }
+
Review Comment:
It's not enough.
PTAL on repro: https://github.com/ssheikin/maven-release-1394-repro#running-it
Also, let me share AI reasoning about it:
```
Here's the actual Maven mechanism, in three steps.
1. The annotation becomes a default expression in plugin.xml.
@Parameter(defaultValue = "true", property = "pushChanges") (AbstractScmReadWriteReleaseMojo.java:79) is compiled by maven-plugin-tools into the plugin descriptor as a default configuration entry, roughly:
<configuration>
<pushChanges default-value="true">${pushChanges}</pushChanges>
</configuration>
So out of the box, the parameter's configured value is the expression ${pushChanges}. property is just "the name of the expression that goes in this slot."
2. The POM <configuration> is merged on top of that descriptor default (a DOM merge).
When your POM declares:
<configuration><pushChanges>false</pushChanges></configuration>
Maven merges it over the descriptor config with Xpp3Dom merge rules. Same element name → the POM's child replaces the descriptor's. The effective config for the mojo execution is now the literal:
<pushChanges>false</pushChanges> <!-- the ${pushChanges} expression is gone -->
3. Configuration injection evaluates expressions — but there's no longer one.
The component configurator walks the merged config and, for each ${...}, calls PluginParameterExpressionEvaluator, which is what resolves ${pushChanges} against session.getUserProperties() (your -D values).
But after step 2 the value is the plain string "false" — no ${...}, nothing to evaluate, -D is never read. The field is set to false.
So the rule is: -Dxxx only feeds a parameter whose configured value is still the ${xxx} expression — i.e. one you did not set explicitly in <configuration>. property supplies a default, it is not an override
channel.
Why it feels surprising: -DskipTests "always works" only because projects rarely hardcode <skipTests> in surefire's <configuration> — the ${skipTests} expression stays live. Hardcode
<skipTests>false</skipTests> and -DskipTests=true is ignored the exact same way.
Why that forces the fix where it is: once the literal wins, the mojo field is false, so descriptor.setPushChanges(pushChanges) can only ever propagate false. The raw -DpushChanges survives only as
session.getUserProperties(), which reaches DefaultReleaseManager.prepare(...) as prepareRequest.getUserProperties() — hence the override must be applied there, not at the mojo.
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Allow override pushChanges from terminal [maven-release]
Posted by "ssheikin (via GitHub)" <gi...@apache.org>.
ssheikin commented on PR #1394:
URL: https://github.com/apache/maven-release/pull/1394#issuecomment-5790751993
@kwin @slachiewicz please review
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org