I’m looking for a way to collapse source sets inside a java-library
subproject, and have the distribution zip contain jars only, not individual classes.
I am attaching a gist illustrating my problem. Referring to it-
I am showing 2 versions of api/build.gradle
, one in which :api
is a java-library
subproject (which is what I want) and one where it’s only a java
subproject.
As it is, the java-library
version works, but it creates archives as follows:
-
api.jar
containsAnInterface.class
only, notAnEnum.class
. -
dist.zip
containsapi.jar
andAnEnum.class
.
Is there a way to get the individual .class
files from dist.zip
to be packed in an inner Jar? E.g. get Enum.class
packed inside api.jar
?
I know I can obtain inner jars only by having :api
be java
subproject (see other api/build.gradle
), the difference boiling down to this: https://docs.gradle.org/current/userguide/java_library_plugin.html#sec:java_library_classes_usage
However, I would prefer having :api
be a java-library
because of the finer-grained dependency management it offers.