Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MNG-8594] Add atFile option #2131

Merged
merged 5 commits into from
Feb 26, 2025
Merged

[MNG-8594] Add atFile option #2131

merged 5 commits into from
Feb 26, 2025

Conversation

cstamas
Copy link
Member

@cstamas cstamas commented Feb 26, 2025

Where user can create ad-hoc command line parms. The difference between .mvn/maven.conf and this file is that this file allows goals as well. The CLI and atFile are merged, in this order, hence, goals in atFile will come AFTER goals specified on CLI, if CLI has them.

Source order (first wins for options, while goals are collected/aggregated from sources):

  • CLI
  • atFile (if specified, may have goals that are appended)
  • maven.config (if present, may not have goals)

Note: option is called af or long at-file for similarity with javac @file, but commons CLI does not support options without leading hyphen.


https://issues.apache.org/jira/browse/MNG-8594

Where user can create ad-hoc command line parms. The difference
between .mvn/maven.conf and this file is that this file allws
goals as well. The CLI and atFile are merged, in this order,
hence, goals in atFile will come AFTER goals specified on CLI.

---

https://issues.apache.org/jira/browse/MNG-8594
@cstamas cstamas added this to the 4.0.0-rc-3 milestone Feb 26, 2025
@cstamas cstamas self-assigned this Feb 26, 2025
@cstamas cstamas requested a review from gnodet February 26, 2025 10:40
@cstamas cstamas marked this pull request as ready for review February 26, 2025 11:02
@gnodet
Copy link
Contributor

gnodet commented Feb 26, 2025

Looks good, that can be handy !
Any way to add a small UT or IT maybe ?

@cstamas
Copy link
Member Author

cstamas commented Feb 26, 2025

@gnodet Added IT, that revealed precedence issue in case of User Properties (-D) that was present for maven.config as well, fixed.

@@ -181,7 +181,9 @@ protected Optional<Map<String, String>> collectMapIfPresentOrEmpty(
Optional<Map<String, String>> up = getter.apply(option);
if (up.isPresent()) {
had++;
items.putAll(up.get());
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was putAll, meaning property coming from lower precedence (they are in-order), overwrote already present (higher precedence) property.

Copy link
Contributor

@gnodet gnodet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@cstamas cstamas merged commit 12ff710 into apache:master Feb 26, 2025
13 checks passed
@cstamas cstamas deleted the MNG-8594 branch February 26, 2025 17:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants