elasticpath / mvnmin

Builds only changed maven modules, speeding up your multi-module maven project builds.
Apache License 2.0
44 stars 0 forks source link

Use of -rf flag breaks multi-reactor builds #12

Open SamuelCook opened 3 years ago

SamuelCook commented 3 years ago

The -rf / --resume-from flag can be used to resume a Maven build from a particular project. This is useful when fixing an error in a project in the middle of a reactor - it is not necessary to rebuild the projects that do not depend on the failing project.

When using mvnmin the -rf flag is passed down to Maven, and works as expected for single-reactor builds. However, it does not function for multi-reactor builds.

Since the -rf flag is always passed down to the running Maven build, it will be present for reactors that do not contain the project from which the build should resume. When mvnmin attempts to build a reactor that does not contain the project, Maven, and consequently, mvnmin, fails with the following message:

[ERROR] [ERROR] Could not find project to resume reactor build from: :<resume-from-project> vs <reactor that does not include the project> @
[ERROR] Could not find project to resume reactor build from: :<resume-from-project> vs <reactor that does not include the project> -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MavenExecutionException

mvnmin: Maven failed to run successfully.

mvnmin should intercept the -rf / --resume-from flag and pass it down to Maven only in reactors that include the specified project.

ivanjensen-ep commented 3 years ago

Hi @SamuelCook,

Sorry for the slow response, It seems my notifications are not configured properly. Yes, this is a known limitation of mvnmin currently.

I had considered intercepting -rf previously, having hit the same irritation. I didn't try it, because I thought it might be tricky. But now you suggest it, I can't think why that would be. I'll take a look into this when I get a chance, thanks for the suggestion.

-Ivan

ivanjensen-ep commented 2 years ago

@SamuelCook You later issue on -am and -amd got me thinking about this again.

I think I've added initial -rf support in the pr #18. I haven't done any serious testing, but on its face it seems like it works. The PR simply sets all sub reactors to skip until the one flagged by the rf arg, and then things progress as before.

Does that match your expectations?

Does that

SamuelCook commented 2 years ago

Yes, that seems about right to me.

Don't forget that you also need to omit the flag in later reactors that do not include the resume-from module.