spring-projects / spring-rewrite-commons

Apache License 2.0
6 stars 10 forks source link

Use maven embedder #68

Open fabapp2 opened 7 months ago

fabapp2 commented 7 months ago

What needs to be done?

Spike to figure out how to replace the custom Maven parsing with something more solid.

Why does it need to be done?

The parsing of Maven projects is implemented with (naive) custom code that parses trivial and most common Maven projects. But, it has many limitations compared to Maven's parsing capabilities. Attempting to remove these limitations would require a reimplementation of Maven's parsing logic which is not feasible.

Requirements

Options

Different options exist to execute Maven goals from Java code. These are the options I am aware of and have looked into:

Solution

None of the solutions above fulfill the requirements. But, the MavenCli has everything required to start a Maven build from within the same JVM process. It hides the access to the MavenExecutionResult. I created a shameless copy of the MavenCli and provide the listener through this implementation. This guarantees that the build is as close as possible to what Maven does with the EmbeddedMaven.