Gradle 5.3 : transitive dependencies not present in compile classpath


We have a multi-project build where projectA depends on projectC and some third party dependency (lets say : httpCore). projectB depends on projectA’s jar and httpCore. So when using java plugin, on compiling projectB, projectA’s jar is created and used properly. But i have to declare same dependencies (snakeyaml) for projectB as implementation dependencies of projectA are not shown in projectB.
we have a lot of such dependencies in projectA that i would like to expose to projectB, but i am not able to with any of the configurations except compile but don’t want to use it as it will be deprecated.

I searched and found i could use java-library plugin and api configuration for the dependecies that i want to expose which works fine. But when i compile projectB, it will not create projectA’s jar and will directly use the classes.

So, is there a way to use java plugin and expose some dependencies to consumer ? I would prefer using java plugin.
If not, when using java-library plugin, is there any way to create projectA jar and add to classpath instead of directly using classes.
I will not prefer java-library as i read it has problems with war plugin which we need to use.