Nolequen :
According to API and implementation separation doc the java-library
plugin should be used to declare dependencies as api
:
apply plugin: 'java-library'
Is java-library
full replacement for java
plugin? or there are cases when both of them should be used?
Francisco Mateo :
The java-library
is plugin is as it names implies: a plugin for Java libraries. If you are developing a library in Java, then it makes sense to use the java-library
plugin.
If you are just developing a plain Java application, then simply use the java
plugin as usual.
The java-library
plugin applies the java
plugin internally: https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/java/org/gradle/api/plugins/JavaLibraryPlugin.java#L38