Hi Guillaume,

+1, also +1 to add a hint in the mojo descriptor if the plugin is mvn4
compatible (version=xxx) to fully isolate it from the maven.core class
realm except the API which will avoid some headache in our tooling and at
runtime!
think it is the way we should priviledge to have a smoother and smaller
code maintenance.

Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> |  Blog
<https://rmannibucau.metawerx.net/> | Old Blog
<http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
LinkedIn <https://www.linkedin.com/in/rmannibucau> | Book
<https://www.packtpub.com/application-development/java-ee-8-high-performance>


Le lun. 14 mars 2022 à 08:59, Guillaume Nodet <[email protected]> a écrit :

> Hi everyone,
>
> As Michael hinted at this new API in the "[DISCUSS] Radical Fast Forward to
> 3.5.4" thread, I'd like to start the discussion around it.
>
> Over the past weeks, I've worked on an experimental API for Maven 4.x.
> The goals are multiple :
>   * fix some problems with designs that do not work well with
> multithreading
>   * offer a way to finally get rid of deprecated code
>   * offer a complete API (which would deprecate m-artifact-transfer,
> m-dependency-tree)
>   * offer an homogeneous and a bit more modern API
>   * completely hide the maven-resolver, so that it can finally upgrade to a
> v2 with the package renamed without too much disturbance
>
> The goal would be to extract the models and API in a separate project with
> a much lower release cycle, as those rarely change, but are currently
> released with each version of maven.
>
> The current API can be seen at [1].  Note that the plugins API has also
> been included within the new API and the plugin tools have been updated so
> that the maven-plugin-plugin supports both v3 api and the new v4 api.  A
> new flag has been added to the MojoDescriptor to know if the plugin is
> using the old or the new api.  The plugin testing harness tools have been
> updated to junit 5 and now provide a few annotations [2] to help writing
> plugin tests [3].  The maven-core has been enhanced to support loading
> those new v4 plugins along with the v3 ones, which means they can work
> side-by-side in the same build.  This is done by implementing the new API
> by wrapping the v3 implementation classes (such as MavenSession,
> MavenProject, etc...) [4].
> I've ported a few plugins such as clean [5], install [6], deploy [7] as a
> proof-of-concept that this actually works.
>
> The very rough goal would be to to have multiple phases:
>   * continue the work on this API so that it can actually cover all use
> cases for plugins, create a new project with the new API and models, make
> sure plugins can work correctly with the new API / implementation
>   * release the API, then maven-core supporting the new API
>   * upgrade plugins to the new API, deprecate old components and API
>   * once all plugins have migrated to the new API, switch maven-core
> implementation to the new API
>
> I'm eager to hear your thoughts !
>
> [1]
>
> https://github.com/apache/maven/tree/mvn4/maven-core-api/src/main/java/org/apache/maven/api
> [2]
>
> https://github.com/apache/maven-plugin-testing/tree/mvn4/maven-plugin-testing-harness/src/main/java/org/apache/maven/api/plugin/testing
> [3]
>
> https://github.com/apache/maven-deploy-plugin/blob/mvn4/src/test/java/org/apache/maven/plugins/deploy/DeployFileMojoTest.java
> [4]
>
> https://github.com/apache/maven/tree/mvn4/maven-core/src/main/java/org/apache/maven/internal/impl
> [5] https://github.com/apache/maven-clean-plugin/tree/mvn4/
> [6] https://github.com/apache/maven-install-plugin/tree/mvn4/
> [7] https://github.com/apache/maven-deploy-plugin/tree/mvn4/
>
> --
> ------------------------
> Guillaume Nodet
>

Reply via email to