Only injects properties into every reactor project once#700
Only injects properties into every reactor project once#700TheSnoozer merged 1 commit intogit-commit-id:masterfrom
Conversation
Enabling `injectAllReactorProjects` in large and old reactor projects allows to avoid repeatedly parsing the git history to retrieve the information. In the apache/james-project enabling this property allowed to lower the time spent in git-commit-id from 39s[1] to 2s[2]. However, looking at the verbose logs one can see that the plugin keeps injecting the properties into every reactor project for every project where the plugin runs. This commit aims to avoid reinjecting keys which have already been set in the context. [1] https://ge.apache.org/s/xumcl7ztpkmhw/timeline?collapse-all&outcome=success,failed&view=by-type [2] https://ge.apache.org/s/gpnevfknmdv5a/timeline?collapse-all&hide-timeline&outcome=success,failed&view=by-type
|
Thanks for all the details and your contribution to this project :-) I can't see anything wrong in your contribution and your changes make a lot of sense to me. Let's try to avoid wasteful things :-) Perhaps worth to mention that you can also tell the plugin to execute only once by using the mais maintenant merci encore pour votre contribution :-) |
|
Wow I never expected this to be reviewed and merge that fast, thanks !
I did notice about this option, unfortunately it can' t be used for the james project. Most of the projects in the the reactor are made available on apache snapshot repository and released on maven central. To ease diagnostic when a problem occurs we embed a small json file into every jars. In the end cheers ! |
|
Can we also merge this feature in version 4. x.x, as many projects use JDK 1.8. |
Context
Enabling
injectAllReactorProjectsin large and old reactor projects allows to avoid repeatedly parsing the git history to retrieve the information.In the apache/james-project enabling this property allowed to lower the time spent in git-commit-id from 39s[1] to 2s[2].
However, looking at the verbose logs one can see that the plugin keeps injecting the properties into every reactor project for every project where the plugin runs.
This commit aims to avoid reinjecting keys which have already been set in the context.
[1] https://ge.apache.org/s/xumcl7ztpkmhw/timeline?collapse-all&outcome=success,failed&view=by-type
[2] https://ge.apache.org/s/gpnevfknmdv5a/timeline?collapse-all&hide-timeline&outcome=success,failed&view=by-type
Contributor Checklist
mvn clean packagecheckstylecoding style definition:mvn clean verify -Pcheckstyle -Dmaven.test.skip=true -BI'm not saying the fix is perfect, but hopefully it illustrates the issue. If you want a sample project to reproduce you can look at https://github.com/apache/james-project/ enabling verbose output on git-commit-id you will be able to see that for every single project the plugin reinjects all the properties in the 273 projects of the reactor ... effectively setting the properties 273*273 =74529 times.
The performance impact is not huge since its all in memory accesses but it still feels quite wasteful