Hello. I tried to prepare `Isolated Projects` feat...
# dependency-management
g
Hello. I tried to prepare
Isolated Projects
feature on my sample android app project. This app project has
convention plugin
which has dependencies with AGP, KGP, KSP and etc... After migrated
subprojects
to
gradle.lifecycle.beforeProject
(as recommended), I found all plugins should be loaded which have dependent with convention plugin on
settings.gradle.kts
https://github.com/ganadist/minimal-reproducible-example/commit/1ab2053d43b933554b3b273b3d2c43b8cd85e8f9 After the migration, I did verify that the build works, but dependency management of plugins has become very cumbersome. 😞 I want to know if the method I used is correct and if there is a better way.
p
You could define a settings plugin in your build-logic build and apply the settings plugin in your build-logic, (or add the convention project in settings.gradle with apply false): https://github.com/hfhbd/adventOfCode/blob/main/settings.gradle.dcl
v
or add the convention project in settings.gradle with apply false
That already is what he is doing. The question though is, why you add all the other plugins multiple times and also define additionally a default version. Just remove the default versions (the stuff in the
pluginManagement { plugins { ... } }
block and also remove all the plugins in the
plugins { ... }
block except for your convention plugin. Your convention plugin already has dependencies on the plugins, so they are already added to the same classpath. If you then apply those plugins in project build scripts without a version, it will just use the one that is on the classpath without an "unknown version" complaint. The problem in the current setup is, that your convention plugin has dependencies on the plugins so they come to the classpath with unknown version as only the plugins from the
plugins { ... }
block have known version, and by defining the default versions in the
pluginManagement
block you effectively in the project build scripts apply the plugins with that version and thus there is the problem with the "unknown" version.
g
@Vampire: Thank you for kindly and detailed response. After apply this change, It has become a bit more concise compared to the previous implementation.
👌 1