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] Make the v4 api usable outside the Maven runtime #1441

Merged
merged 10 commits into from
Mar 25, 2024

Conversation

gnodet
Copy link
Contributor

@gnodet gnodet commented Mar 15, 2024

First step at making the Maven 4 API usable outside a full maven process.
This PR includes:

  • move Maven 4 api implementation classes from maven-core into a new maven-api-impl module
  • implement native services for settings and toolchains builders, make v3 implementation wrap the new ones
  • various API enhancements related to the two services above

The Maven 4 API is not completely usable outside Maven yet, but here's a working example:

        Session session = ApiRunner.createSession();

        ArtifactCoordinate coord = session.createArtifactCoordinate("org.apache.maven:maven-api-core:4.0.0-alpha-13");
        Map.Entry<Artifact, Path> res = session.resolveArtifact(coord);
        assertNotNull(res);
        assertNotNull(res.getValue());
        assertTrue(Files.exists(res.getValue()));

        Node node = session.collectDependencies(session.createDependencyCoordinate(coord));
        assertNotNull(node);
        assertEquals(8, node.getChildren().size());

@gnodet gnodet force-pushed the lw-api branch 2 times, most recently from 0519c8f to 03ee667 Compare March 15, 2024 22:46
@gnodet gnodet requested a review from cstamas March 18, 2024 09:52
@gnodet gnodet marked this pull request as ready for review March 18, 2024 09:53
@cstamas
Copy link
Member

cstamas commented Mar 18, 2024

IIUC, this moves things out from maven-core to somewhere at line of maven-resolver-provider?

@gnodet
Copy link
Contributor Author

gnodet commented Mar 18, 2024

IIUC, this moves things out from maven-core to somewhere at line of maven-resolver-provider?

Yes, the dependencies are:

  • maven-api-core (so the whole maven api)
  • maven-di (the dependency injection framework)
  • maven-resolver-provider
  • and obviously the resolver

The next step would be to make maven-resolver-provider and maven-model-builder built on top of the maven 4 model to make it even more lightweight.

@gnodet gnodet changed the title Extract a lightweight API implementation to be used outside of maven (wip) [MNG-8084] Make the v4 api usable outside the Maven runtime Mar 22, 2024
@gnodet gnodet merged commit 003a5bc into apache:master Mar 25, 2024
13 checks passed
@gnodet gnodet added this to the 4.0.0-alpha-14 milestone Mar 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants