Composite build can't find symbol when building

I’m using gradle 4.7 for a composite build.

I have a demo app and a demo lib. I’m using a class from the demo lib in my app but when I try to use a composite build my app is unable to find the class.

When I run:

./gradlew --include-build ../demo-lib build

I get a compile failure:

demo-app/src/main/java/com/example/demoapp/PersonController.java:5: error: package com.example.lib.demolib does not exist
import com.example.lib.demolib.Person;

I’ve checked the basic composite sample and it works, but I can’t figure out what I’m doing wrong… I see that demo-lib is getting built, but it doesn’t seem to be getting on the class path?

:compileJava (Thread[Task worker for ':demo-lib' Thread 2,5,main]) completed. Took 0.02 secs.