Diff between compile api, implementation
Use compile, resolve dependencies
|api||Declaring API dependencies||Expose to customers, customers know what api to use. (Customer codes is also used when using this library)|
|implementation||Declaring implementation dependencies||Purely use in App or Library. Customer library does not care to call this dependencies.|
api is basically used by child module or library. General application developer does not need to use.
The Java Library Plugin page has a great sample how to use api and implementation.