You can write custom rule for maven-enforcer-plugin and use it for running on your maven project.
You might also want to use the mojo-executor to parse the plugin.xml
file for checking its "thread safe" property.
A little elaboration on when and why you should use the above.
When you are working in CI/CD environment, and you want to employ the parallel compilation via maven, you should constantly monitor that your developers are not adding non-thread safe plugins, in order to ensure the consistency and correctness of the CI/CD. In order to achieve that, you can use the above mentioned maven-envorcer-plugin with custom rule. Your custom rule can use the Maven Plugin API (maven project, etc.) in order to search all the plugins in the projects, and then use the mojo-executor lib in order to read the threadSafe
property of each plugin (since the maven API does not provide that). mojo-executor lib has tools to parse the plugin.xml
file of a maven plugin where the threadSafe
property resides.
Once found, you can fail the maven build.
If you want to see only the list of the non-thread safe plugins, you can use the same technique, and just list the plugins which threadSafe
property is false.
You can then configure the maven-enforcer-plugin
to use the custom rule (for example, a profile of the project), and run it via command line in a single maven command.
BTW, what happens when you find a non-thread safe plugin in your development project, and there are no thread safe alternatives, is another question, which is also solvable.