HI,
I’m using the gradle platform plugin; I have a BOM project that declares version constraints, and an App project that gets version recommendations from the BOM project. while this works great for the dependencies clause, I’m not sure if I can get the same recommendations outside of it. for example, I also have the following protobuf clause:
I am not super familiar with the Prorobuf plugin, but it looks like it creates configurations called protobufToolsLocator... for resolving the tools. You can add you platform project to these so that it provides the versions. Then you can define the artifacts without version.
my platform project is not a subproject, so I’m getting this error if I try to use your syntax (assuming my project is called P, my group called X and my artifact called Y):
Project with path ‘X:Y:1.0.+’ could not be found in project ‘:P’.
so I tried to remove the project from the call, like this:
configurations.all {
if (it.name.startsWith('protobufToolsLocator')) {
it.dependencies.add(project.dependencies.create(platform('X:Y:1.0.+')))
}
}
but I’m getting this error message:
Could not find method platform() for arguments [X:Y:1.0.+] on configuration ‘:P:protobufToolsLocator_protoc’ of type org.gradle.api.internal.artifacts.configurations.DefaultConfiguration.
With that version, you would inherit all dependencies declared on the api configuration and its parents, not only the platform, so this might not be optimal.