Slackbot
04/11/2022, 4:45 PMDavid Chang
04/12/2022, 1:12 AMMaxim Alov
04/12/2022, 6:05 AMpluginManagement {}
block?
The way we do it - from flat settings - leads to just replace dependency in some dependencies {}
block which is then used to locate classes used in implementation, or plugins applied in precompiled-scripts used when we make convention plugins.
I believe, it would be more natural if we could substitute plugin, not a dependency (which is then supposed to provide that plugin), as we normally do in pluginManagement -> resolutionStrategy {}
block, as I shown in my sample. In other words, I'd like not to replace dependency given its group:artifact, but plugin given it's id and applied in plugins {}
block. I'd like it to work for any plugins {}
block in the composite project.
Because, if I use the approach replacing dependency with it's group:artifact, that means I HAVE TO make convention-plugin wrapper, that would wrap plugins {}
block with the plugin I'd like to substitute. And hence, I have to apply that convention-plugin everywhere instead of appliance raw plugin I want to substitute explicitly in each subproject in plugins {}
block.
Does it make sense?Maxim Alov
04/12/2022, 6:09 AMdependencySubstitution {}
block is not available for includeBuild()
from pluginManagement
. Ok, but when I tried to do the same with pluginManagement -> resolutionStrategy {}
, I failed to substitute - it was always using original 3rd-party org.sonarqube
plugin instead of those provided from included-build.Vampire
04/12/2022, 8:25 AMincludeBuild
the build and it should work usually.
Having the includeBuild
outside the pluginManagement
comes from not so far times where only the outer one existed.
But for plugins it is preferable and for settings plugins even required to do it inside the pluginManagement
block.Vampire
04/12/2022, 8:54 AMMaxim Alov
04/13/2022, 6:41 AMincludeBuild("/Users/mymac/Soft/OPENSOURCE/sonar-scanner-gradle")
outside any block in my settings.gradle
.
my convention plugin was declaring dependency on
implementation org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:3.3
but after adding includeBuild()
, for it to be substituted I had to change this declaration to
implementation org.sonarsource.scanner.gradle:sonarqube-gradle-plugin
after that, my convention plugin had the local changes I made in my local version of org.sonarqube
plugin.Vampire
04/13/2022, 7:48 AMMaxim Alov
04/13/2022, 7:52 AMorg.sonarqube
plugin applied from plugins {}
block in some of my subprojects, w/o having any convention plugins (not using as a dependency), then I'd just need to add
includeBuild("/Users/mymac/Soft/OPENSOURCE/sonar-scanner-gradle")
inside pluginManagement {}
block and that's it?
And it will silently substitute every appliance of org.sonarqube
with my local version of it without any changes in any build scripts required?Vampire
04/13/2022, 7:55 AM