Skip to content

Fix #12868: Restore --define as long option for -D - #12869

Merged
gnodet merged 1 commit into
masterfrom
fix-issue-12868
Aug 28, 2026
Merged

Fix #12868: Restore --define as long option for -D#12869
gnodet merged 1 commit into
masterfrom
fix-issue-12868

Conversation

@gnodet

@gnodet gnodet commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

Closes #12868

Summary

  • Restores --define as the long option for -D, which was present in Maven 3.x but accidentally omitted during the Maven 4 CLI rewrite (CLIng)
  • Adds .longOpt("define") to the -D option builder in both the new CLI (CommonsCliOptions) and the compat layer (CLIManager)
  • Adds unit tests verifying both -D and --define work correctly

Test plan

  • New CommonsCliOptionsTest verifying -Dfoo=bar, --define foo=bar, and multiple --define options
  • Module-specific tests pass (mvn test -Dtest=CommonsCliOptionsTest)
  • Full reactor build passes (mvn clean install -DskipTests)
  • CI passes (all 22 checks green)

🤖 Generated with Claude Code

The --define long option was the long form of -D in Maven 3.x but was
accidentally omitted during the Maven 4 CLI rewrite (CLIng). This restores
.longOpt("define") on the -D option builder in both the new CLI
(CommonsCliOptions) and the compat layer (CLIManager).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@gnodet gnodet added this to the 4.0.0-rc-7 milestone Aug 27, 2026
@gnodet gnodet added the bug Something isn't working label Aug 27, 2026
@gnodet
gnodet marked this pull request as ready for review August 27, 2026 17:56

@gnodet gnodet left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Clean, minimal regression fix that correctly restores --define as the long option for -D, matching Maven 3.x behavior. The one-line production changes are precise and the new test class adequately covers the fix.

The fix is verified correct by comparing with maven-3.9.x and maven-3.10.x branches, where .longOpt("define") is present on the -D option. The omission clearly happened during the Maven 4 CLI rewrite (CLIng) when the option builder was rewritten and the .longOpt("define") was accidentally dropped.

Test coverage is good: tests cover -Dfoo=bar (short form), --define foo=bar (long form), and multiple --define flags.

Minor observations:

  • The compat CLIManager change is untested — the existing CLIManagerDocumentationTest only generates docs. Since this is a deprecated compat layer and the primary CLI has proper test coverage, this is acceptable.

🔀 Backport Status

⚠️ This bug fix targets master but no backport PR was found for:

  • maven-4.0.x — has the same omission (confirmed by examining the branch)

The maven-3.9.x and maven-3.10.x branches already have .longOpt("define"), so no backport is needed there.

Consider creating a backport PR or adding a backport-to-maven-4.0.x label.

This review was generated by an AI agent and may contain inaccuracies. Please verify all suggestions before applying.

Claude Code on behalf of Guillaume Nodet

@gnodet gnodet modified the milestones: 4.0.0-rc-7, 4.1.0 Aug 28, 2026
@gnodet
gnodet merged commit 7749971 into master Aug 28, 2026
24 checks passed
@gnodet
gnodet deleted the fix-issue-12868 branch August 28, 2026 13:27
gnodet added a commit that referenced this pull request Aug 28, 2026
The --define long option was the long form of -D in Maven 3.x but was
accidentally omitted during the Maven 4 CLI rewrite (CLIng). This restores
.longOpt("define") on the -D option builder in both the new CLI
(CommonsCliOptions) and the compat layer (CLIManager).

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

maven 4.0 regression: --define unrecognized

2 participants