chonton / exists-maven-plugin

Check if artifact exists in remote maven repository
Apache License 2.0
47 stars 18 forks source link

Make exists goal thread-safe #20

Closed joehni closed 2 years ago

joehni commented 4 years ago

When using parallel execution with Maven, we get the following warning:

[WARNING] [WARNING] Your build is requesting parallel execution, but project [WARNING] contains the following plugin(s) that have goals not marked [WARNING] as @threadSafe to support parallel building. [WARNING] While this /may/ work fine, please look for plugin updates [WARNING] and/or request plugins be made thread-safe. [WARNING] If reporting an issue, report it against the plugin in [WARNING] question, not against maven-core [WARNING] [WARNING] The following plugins are not marked @threadSafe in MyProject Modules: [WARNING] org.honton.chas:exists-maven-plugin:0.1.0 [WARNING] Enable debug to see more precisely which goals are not marked @threadSafe. [WARNING] *****

It would be nice to get a thread-safe implementation of the goal. Adding the annotation would be easy, but I don't know how the plugin checks the artifact existence. Maybe the remote repo access needs synchronization - possibly synchronized based on the checked group and arfifact id.

chonton commented 4 years ago

The plugin is probably thread safe. There are no static fields nor singletons to be concerned with. However, there may be a race to set/get the "exists.property". It might be safe if you have the aggregator module's artifact stand-in for entire project (use a profile that's only activated in the aggregator module)

I can mark the goals as threadsafe, but I want to think more about the consequences.