I have a multi-project build. Projects do have external dependencies as well as project-dependencies. During compilation project dependencies get recognized well, however, in the final tar (created by the distribution plugin) there are old snpashot jars instead of the newly created once.
Already tried to delete the cache, behavior is still the same. Found out that this only happens for projects that create a .jar whose name was included earlier on as an external .jar dependency already.
E.g: Project :service:My-Service has a project dependency on :shared:My-Shared-Lib and :shared:New-Shared-Lib. My-Service will correctly use My-Shared-Lib and New-Shared-Lib during compilation. For some reason the .tar produced by the distribution plugin will not include the same dependencies as used during compilation. It will include the newly built .jar from project New-Shared-Lib, as it didn’t exist before. However, as My-Shared-Lib produces a .jar whose name was used as an external dependency earlier on, gradle seems to get confused and downloads an old version from the repository.
build.gradle
in :service:My-Service:
dependencies {
implementation project(':shared:My-Shared-Lib') // earlier on included by implementation 'org.example:My-Shared-Lib:10.+'
implementation project(':shared:New-Shared-Lib') // totally new, never pushed to the repo before
}
I would expect gradle to use the exact same dependencies as used during build time.