I am working on decomposing a large java application which uses the java library plugin. Some of the confusion I have is with api vs. implementation. I have read the documentation but I fail to have clarity on the following.
If Module M depends on A, which depends on B (api), and M only uses B in order to use A. Our understanding is B is NOT explicitly added to the dependences of Module M (sort of the point of api). Is this agreed upon? Is there a way to detect this VIA gradle today?
If Module A depends on Module B for API reasons ONLY, and then starts using Module B for implementation purposes in the future, should you list both api and implementation for correctness? Why or why not?
Is there some mechanism that exists to verify the validity of the build.gradle files in terms of how the classes are used? e.g. unnecessary api dependencies that COULD/SHOULD be implementation OR vice versa?
What about package private classes across modules? :m → :a where the same package is in both modules, do we need to ensure that all classes in :a that are in the same package follow the same rules as IF the class is module :m?
ClassA is package private and in module A and uses ClassX for its api (in module X). Does A have an api dependency on X or NOT?