Classes in transitive project dependencies not available for the root project

I have 3 projects. fc is the root project.
project fc depends on conf and conf depends on base

base

build.gradle

apply plugin: 'java'

conf

build.gradle

apply plugin: 'java'

dependencies {
    implementation project(':base')
}

fc (root project)

build.gradle

apply plugin: 'java'

dependencies {
    implementation project(':conf')
}

settings.gradle

include ':conf'
project(':conf').projectDir = new File(settingsDir, '../conf')

include ':base'
project(':base').projectDir = new File(settingsDir, '../base')

When I run gradle build from fc project, I get below compilation error.


> Task :compileJava FAILED
/home/adithyan/all-files/coding/repo/office-git/build-script/mod2/gradle-test/fc/src/main/java/fc/FcClass.java:3: error: package abc does not exist
import abc.BaseClass;
          ^
/home/adithyan/all-files/coding/repo/office-git/build-script/mod2/gradle-test/fc/src/main/java/fc/FcClass.java:9: error: cannot find symbol
        BaseClass bc = new BaseClass();
        ^
  symbol:   class BaseClass
  location: class FcClass
/home/adithyan/all-files/coding/repo/office-git/build-script/mod2/gradle-test/fc/src/main/java/fc/FcClass.java:9: error: cannot find symbol
        BaseClass bc = new BaseClass();
                           ^
  symbol:   class BaseClass
  location: class FcClass
3 errors

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':compileJava'.
> Compilation failed; see the compiler error output for details.

The error indicates, that the classes in the base project are not available to the compilation process of project fc.

Why?

The reason is that implementation dependencies are internal to the subproject that uses them to prevent accidental “dependency pollution”. See this recent blog post for a rationale. If you want them to be exported because they are part of the API of base, I’d recommend using the java-library plugin and its api configuration. Alternatively, you can use compile instead of implementation with the regular java plugin.

Thanks a lot for the reply. It worked.