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-8084] Move ModelBuilder and resolver provider to v4 api #1457

Merged
merged 2 commits into from Apr 12, 2024

Conversation

gnodet
Copy link
Contributor

@gnodet gnodet commented Mar 27, 2024

This provides a re-implementation of maven-model-builder and maven-resolver-provider on top of the Maven 4 api.
As a consequence, apart from projects, plugins and actual build, all the v4 api and resolution should be available outside of maven with just the api, maven-di, maven-api-impl and the resolver.

Note that the builder and resolver provider are not yet used by maven.

@gnodet gnodet marked this pull request as draft March 27, 2024 04:48
@gnodet gnodet force-pushed the model-builder-v4 branch 3 times, most recently from 3972cf3 to 230946d Compare March 29, 2024 08:58
@gnodet gnodet requested a review from cstamas March 29, 2024 09:13
@cstamas
Copy link
Member

cstamas commented Mar 29, 2024

Maybe "v3 mode" should use old stuff, and "v4 mode" should use this new stuff? As we also have "v3 scopes vs v4" scopes, and v4 scopes should not be used with v3 modes...

@gnodet
Copy link
Contributor Author

gnodet commented Mar 29, 2024

Maybe "v3 mode" should use old stuff, and "v4 mode" should use this new stuff? As we also have "v3 scopes vs v4" scopes, and v4 scopes should not be used with v3 modes...

How would you decide which one is used ?
The Maven3ScopeManagerConfiguration is not used atm afaik. I just copied those to accommodate the recent changes.

I'm working on rewriting the ProjectBuilder on top of the new ModelBuilder, to at least fix any regression using unit tests and integration tests.

Once we have full support, we could think of having two different builders at the same time if we need to configure them differently. What kind of changes would you see ?

@cstamas
Copy link
Member

cstamas commented Mar 29, 2024

By project model version?

There is an important distinction:
mvn3 vs mvn4 RUNTIME resolution scopes, former suffer from https://issues.apache.org/jira/browse/MNG-8041 while latter has it fixed.

@gnodet
Copy link
Contributor Author

gnodet commented Mar 29, 2024

By project model version?

There is an important distinction: mvn3 vs mvn4 RUNTIME resolution scopes, former suffer from https://issues.apache.org/jira/browse/MNG-8041 while latter has it fixed.

Right now, mvn3 scopes are not used, so we need those at all ?

@cstamas
Copy link
Member

cstamas commented Apr 2, 2024

I think you are right: mvn4 scopes are "superset" of those of mvn3, plus, if you compare their ordering, they remain in same place (ordering by "width"), this is the two config "dump" output (they have main method that produces this):

Maven3

Maven3 defined dependency scopes:
compile (width=3500)
  Query : [ALL]
  Presence: [main-compile, test, main-runtime]
  Main project scope: main-compile
system (width=2500)
  Query : [ALL]
  Presence: [main-compile, test, main-runtime]
  Main project scope: main-compile
runtime (width=2500)
  Query : [BY_BUILD_PATH(runtime)]
  Presence: [test, main-runtime]
  Main project scope: main-runtime
provided (width=1500)
  Query : [BY_BUILD_PATH(compile), SELECT(test, runtime)]
  Presence: [main-compile, test]
  Main project scope: main-compile
test (width=500)
  Query : [BY_PROJECT_PATH(test)]
  Presence: [test]
  Main project scope: test

Maven4

Maven4 defined dependency scopes:
compile (width=4000)
  Query : [ALL]
  Presence: [main-compile, main-runtime, test-compile, test-runtime]
  Main project scope: main-compile
system (width=3000)
  Query : [ALL]
  Presence: [main-compile, main-runtime, test-compile, test-runtime]
  Main project scope: main-compile
runtime (width=2500)
  Query : [BY_BUILD_PATH(runtime)]
  Presence: [main-runtime, test-runtime]
  Main project scope: main-runtime
provided (width=2000)
  Query : [BY_BUILD_PATH(compile), SELECT(test, runtime)]
  Presence: [main-compile, test-compile, test-runtime]
  Main project scope: main-compile
compile-only (width=1000)
  Query : [SINGLETON(main, compile)]
  Presence: [main-compile]
  Main project scope: main-compile
test (width=1000)
  Query : [BY_PROJECT_PATH(test)]
  Presence: [test-compile, test-runtime]
  Main project scope: test-compile
test-only (width=500)
  Query : [SINGLETON(test, compile)]
  Presence: [test-compile]
  Main project scope: test-compile
test-runtime (width=500)
  Query : [SINGLETON(test, runtime)]
  Presence: [test-runtime]
  Main project scope: test-runtime
none (width=0)
  Query : []
  Presence: []
  Main project scope: null

@gnodet gnodet force-pushed the model-builder-v4 branch 3 times, most recently from d3e5786 to a72311a Compare April 3, 2024 21:34
@gnodet gnodet marked this pull request as ready for review April 3, 2024 21:36
@gnodet gnodet force-pushed the model-builder-v4 branch 2 times, most recently from 24b101e to 1104258 Compare April 4, 2024 14:13
@gnodet gnodet force-pushed the model-builder-v4 branch 2 times, most recently from 417807e to 575ccce Compare April 11, 2024 06:33
@gnodet gnodet merged commit d075fe7 into apache:master Apr 12, 2024
10 of 13 checks passed
@gnodet gnodet added this to the 4.0.0-alpha-14 milestone Apr 12, 2024
@desruisseaux
Copy link
Contributor

A few more changes seem to be necessary for allowing maven-plugin-tools and maven-plugin-testing to compile. I created a commit there, but no pull request yet because I'm not sure if I got the intent right: Geomatys@60a6050

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants