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

Maven CLIng #1750

Draft
wants to merge 16 commits into
base: master
Choose a base branch
from
Draft

Maven CLIng #1750

wants to merge 16 commits into from

Conversation

cstamas
Copy link
Member

@cstamas cstamas commented Sep 27, 2024

New CLI for Maven. Goals are reusability, extensibility and easier embeddability (a la mvnd). If you build this branch, you will end up with Maven distro that uses "new" maven-cli:org.apache.maven.cling.MavenCling class as entry point instead of "old" maven-embedder:org.apache.maven.cli.MavenCli.

First step is to make "pretty much equivalent" capable CLI as compared to "old", with some exceptions:

  • "encryption" ops are gone, those should be in separate tool anyway
  • "deprecated and unsupported" CLI options like -llr present ONLY to make Maven fail are gone (now Arg parser will fail).

Current state of affairs is messy, MavenCli mixes everything it can, contains interleaved logic for bootstrapping, arg parsing, default logic and executing Maven. First goal is to clean this up.

Commons CLI are also hidden in this PR, so is ClassWorlds. This basically opens up way to have "alternative" CLI arguments parsers as well.

Note: naming, as always is off. I just could not come up with better names, so "invoker" and "request" are used, but they are too generic, and they clash with existing Maven Invoker. Have to say, that this work could replace Maven Invoker on longer run with some much simpler and cleaner solution.

Currently the "local" (CLI) flow is this:

arg[] -> localParser -> Request -> localInvoker -> maven runs (in situ)

But the point is if you "come up" somehow with a Request instance, one can also do just:

Request -> invoker -> maven runs (somewhere)

Local parser:

  • parses CLI args
  • infers the defaults
  • creates Request object that contains all information needed to run Maven
  • can be reused outside of CLI as well
  • does NOT fiddle with Plexus, logging, etc.

Local invoker:

  • accepts Request object
  • deals with configuring env (logging, etc), creating DI container, and running Maven ONLY

There are some experiments ongoing as well, like ForkedInvoker is, but also MavenTool.

@cstamas cstamas requested a review from gnodet September 27, 2024 10:34
@cstamas cstamas self-assigned this Sep 27, 2024
@cstamas cstamas force-pushed the maven-cling branch 7 times, most recently from 371ff31 to 6832594 Compare September 27, 2024 16:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants