Configurations dependencies wrong cache path

I have a gradle project with this setup:

configurations {
    app
}

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: 'com.test.aaa', name:'app-proxy', version:master) {
        transitive = false
    }
}

when I do something like this:

configurations.app.collect {
    println "path: $it"
}

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

/Users/myuser/.m2/repository/com/test/APPLICATION1/0-39/APPLICATION1-0-39.jar
or

/Users/myuser/.gradle/caches/modules-2/files-2.1/com.test/APPSERVER/0-33/ecf0b32ac7199d5b228bc69d7a94bf977d772242/APPSERVER-0-33.jar

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

/Users/myuser/Documents/workspaces/git/app/build/libs/app-master.jar

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.
Thanks.

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.

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

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?

Ok thanks for your help, I solved using this: