Configurations dependencies wrong cache path

(Stefano) #1

I have a gradle project with this setup:

configurations {

dependencies {
    app "com.test:APPSERVER:${version}"
    app "com.test:APPLICATION1:${version1}"
    app "com.test:APPLICATION2:${version2}"
    app(group:'com.test', name:myProject, version:master) {
        transitive = false
    app(group: '', name:'app-proxy', version:master) {
        transitive = false

when I do something like this: {
    println "path: $it"

the outputs for all dependencies except “myProject” are like:



but the myProject is always in a path related to the project sources:


so this last jar does not exist and I get obviously this error:

The specified zip file ZIP '/Users/myuser/Documents/workspaces/git/app/build/libs/app-master.jar' does not exist and will be silently ignored.
any idea why myProject’s jar is not searched into the cache path contained into .gradle/cache or .m2/cache as the others?

I did not set any environment variable.

(Chris Doré) #2

As a quick test, make sure your local project’s name is not the same value as myProject. What I think you’re running into is the fact that Gradle will automatically substitute local project dependencies if the group and name matches the external dependency.

(Stefano) #3

Yes the name is the same, but I can’t change it… do you know a way to leave the same name?

(Chris Doré) #4

The only option related to this behaviour that I’m aware of is ResolutionStrategy.preferProjectModules, but that’s the opposite of what you want. However, the default strategy is based on version numbers, so if the version of the local project is lower than the external binary, then the external binary should be used (which you may not be able to work with either).

Why does the project need a dependency on itself?

(Stefano) #5

Ok thanks for your help, I solved using this: