In a configuration, I have a dependency on a JVM l...
# dependency-management
i
In a configuration, I have a dependency on a JVM library. However, this library is actually published by another project in the same build. e.g.
./gradlew :foo:dependencies --configuration barClasspath
baz:bar:1.0.0
and there is a project in the same build called
bar
in the group
baz
. I would like to substitute the dependency with the project, so it always uses the most recent code, without splitting this into multiple builds. Is it possible?
1
v
Does the project have group
baz
and name
bar
or do you manipulate coordinates in the publication configuration? If the latter, you might be at loss and it is bad practice. If the former, then the project should be used if it has the higher version opposed to the binary dependency. If the version is lower and that is why the external dependency is used, you could use
preferProjectModules()
in a resolution strategy to prefer project over external dependency independent of version afair.
i
It does have
group
set in its
build.gradle.kts
file as normal, and its name comes from the folder name, as normal. Nothing weird there, the project
bar
is a completely normal project. But yeah, it might be because the version is lower. I'll try that, thanks 🙂
👌 1
preferProjectModules()
didn't work, but a substitution rule did.
🤷‍♂️ 1
👌 1