Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Further simplification of the ZIP publication implementation
This is WIP, and I am kindly asking for a feedback. This is a follow-up to PR #4156 and brings in a further simplification of the ZIP publication implementation. In the mentioned PR we specifically implemented the functionality to use `project.group` value for the `artifactId` and if there was an override provided by user (ie the `groupId` value was explicitly specified in POM configuration) then it was used instead. Further, we were explicitly setting the artifactId and version as well. But in fact all this has been already happening under the hood (by the libraries that do the heavy lifting of publication tasks processing). There is really no need to (re-)implement it again. As we can see from the modified code and tests that we can perfectly remove almost all the ZIP publication initialization code and all the things still work as expected. And I think it is because this is how the Project Object Model (POM) was designed to work. Because of that the condition to test the groupId presence: `if groupId == null` was useless. It was never `true`. If the `project.group` is not defined the publication task fails with an exception (we test it), if there is a custom `groupId` value setup in publication config then it overrides the `project.group` as well. Again, we test it. :-) On top of that I am not really sure if we needed the condition to test: `if (mavenZip == null)` and create a new instance of MavenPublication if it is null. Hence I removed it and all the tests are still fine. Actually, I can not think of a case where the condition would be met (please prove me wrong). Finally, not only this simplifies existing code but has some interesting consequences for the planned back-porting to `2.x` branch (which is expected to default to a hardcoded groupId `org.opensearch.plugin` unless user provides explicit override in POM configuration). But on that later. Let's now focus on these changes. Signed-off-by: Lukáš Vlček <lukas.vlcek@aiven.io>
- Loading branch information