Transitive dependencies for project with flatDir repository not resolved in multi-project buid

I have a multi-project build like this:

projA/build.gradle:

dependencies {
    project(":projB")
}

projB/build.gradle:

repositories {
    flatDir { dirs 'libs' }
}
  dependencies {
    compile ':jar-in-libs'
}

When I build I get compilation errors because jar-in-libs.jar is not included in the transitive dependencies of projB. I can workaround this by adding fileTree(dir:’…/projB/libs’, include:’**/*.jar’) to projA but its not ideal.

Is this a bug or am I using it wrong?

Thanks

:projA will need it’s own repositories definition. repositories are orthogonal to dependencies, and as you pointed out are not transitive.

You might be best served by having a rootProject above projA and projB and putting the repositories definition and the lib directory at that level. Otherwise, I think you will need flatDir pointing to …/projB/libs like you pointed out.

This should work, but your code contains a syntax error. ‘projA/build.gradle’ doesn’t specify a configuration (e.g. ‘compile’) for the project dependency, which makes the declaration a no-op.

I would expect this to work. However, ‘projA/build.gradle’ contains a syntax error. The dependency declaration is missing a configuration (e.g. ‘compile’), which makes it a no-op.

The dependency declaration is missing a configuration (e.g. compile), which makes it a no-op.

Sorry, that was typo I made in sanitising my setup. I have created a simple testcase that I can provide. In simplifying the problem I don’t get compilation errors anymore. I get:

Could not resolve all dependencies for configuration ‘:projA:compile’. Could not find group:, module:projc, version:.

Required by:

parentProj:projA:unspecified > parentProj:projB:unspecified

There is a jira related to this: GRADLE-1940.