refreshVersions icon indicating copy to clipboard operation
refreshVersions copied to clipboard

Manage plugin versions and related dependencies through custom alias rules

Open DanySK opened this issue 5 years ago • 5 comments

I'm not sure whether to consider this a bug or a feature request (namely, I do not know if the current behavior is there by purpose, if it is an unintended/unspecified behaviour, or if it does not behave as expected)

Describe the bug

Adding custom alias rules may intertwine badly with plugins version management. Consider, e.g.:

plugin.io.gitlab.arturbosch.detekt=1.9.1
version.io.gitlab.arturbosch.detekt..detekt-formatting=1.9.1

Since these two versions must remain aligned, it would be useful to group them into a single versions.properties entry, e.g. by

io.gitlab.arturbosch.detekt:*
                     ^^^^^^

This correctly produces a single version.detekt=1.9.1 entry. However, from this point on, the plugin can no longer get resolved.

To Reproduce

If necessary, I can produce a minimal project using the two plugins mentioned above. Let me know.

Expected behavior the plugin and its dependencies are pulled in with the version specified in the versions.properties file

DanySK avatar Jun 22 '20 09:06 DanySK

Nice find, this is definitely something to specify in the doc.

Plugins do not support version rules, but, there's already a solution for your use case:

version.io.gitlab.arturbosch.detekt..detekt-formatting=plugin.io.gitlab.arturbosch.detekt

I'm taking the note to improve this area.

LouisCAD avatar Jun 22 '20 10:06 LouisCAD

Thanks, however running refreshVersions after the substitution of version.io.gitlab.arturbosch.detekt..detekt-formatting=1.9.1 with version.io.gitlab.arturbosch.detekt..detekt-formatting=plugin.io.gitlab.arturbosch.detekt

produces an invalid version.properties file with both:

version.io.gitlab.arturbosch.detekt..detekt-formatting=1.9.1
##                                         # available=1.10.0-RC1

version.io.gitlab.arturbosch.detekt..detekt-formatting=plugin.io.gitlab.arturbosch.detekt

Is it a known behavior? How to solve or work it around?

DanySK avatar Jun 22 '20 11:06 DanySK

It might be a poorly handled case now that I think about it. I'll test it later and let you know, note taken.

LouisCAD avatar Jun 22 '20 12:06 LouisCAD

@DanySK This works:

Version key rule:

io.gitlab.arturbosch.detekt:detekt(-*)
                     ^^^^^^

version.properties file:

plugin.io.gitlab.arturbosch.detekt=version.detekt

version.detekt=1.9.0
## # available=1.9.1
## # available=1.10.0-RC1

LouisCAD avatar Jun 25 '20 21:06 LouisCAD

Yes this looks like a reasonable workaround! Thanks!

DanySK avatar Jun 26 '20 14:06 DanySK