Ideally, you'd only focus on org.apache.maven.api.* and forget about everything else. That's the Maven 4 API and all other things are not part of that API (including MavenProject).
The class path resolution should be done using the following code: org.apache.maven.api.Session session; org.apache.maven.api.Project project; DependencyResolverResult result = session.getService(DependencyResolver.class).resolve(session, project, ResolutionScope.PROJECT_COMPILE); for (Dependency dependency : result.getDependencies().keySet()) { DependencyProperties properties = dependency.getDependencyProperties(); ... } Le mar. 19 déc. 2023 à 10:50, Martin Desruisseaux < martin.desruisse...@geomatys.com> a écrit : > Hello > > Le 2023-12-19 à 10 h 10, Tamás Cservenák a écrit : > > > These are all good questions. Ideally I'd not touch maven-artifact, > > rather all should be usable with the new Maven API. For example: in > > new Api there is Project, and DependencyResolver service, it does not > > help? (by revealing properties?) > > > Thanks for your reply. I just had a look to DependencyResolver. Can you > confirm if my understanding is right, and point me to the right approach > if not? > > * org.apache.maven.project.MavenProject is the place where the > classpath is built. This is the crucial part of this work, I'm > looking for a central place which does the analysis of dependency > properties and build class-path, module-path, doclet-path, > agent-path, processor-path, etc. from them. > * org.apache.maven.api.services.DependencyResolver has "resolve" > methods which provide dependency properties through the > DependencyResolverResult → Node → Dependency → DependencyProperties > path. > > However in MavenProject (if it is the right place where to build > class-path, module-path, etc.), I see no DependencyResolver, > DependencyResolverResult or Node. How do I make the link? > > Regarding the separation between "maven-artifact" and "maven-api-core" > modules, I see that both of them define their own Artifact interface: > > * org.apache.maven.artifact.Artifact > * org.apache.maven.api.Artifact > > Somewhere there is code that copy data from one structure to the other. > Wouldn't it be simpler to have only one interface? > > Martin > > -- ------------------------ Guillaume Nodet