What expression (in build.gradle
file) evaluates to list of files that are packed into a jar archive by default (without adjusting "jar" task?
I can't easily spot it in sources of org.gradle.jvm.tasks.Jar
and org.gradle.api.tasks.bundling.Jar
.
This question is motivated by using of a custom sourceSet files of which are not added to jar archive.
It's the Java Plugin that adds the jar
task and configures it. You can see this in the source code of the org.gradle.api.plugins.JavaPlugin
class:
private TaskProvider<Jar> registerJarTaskFor(Project project, JavaPluginConvention pluginConvention) {
return project.getTasks().register(JAR_TASK_NAME, Jar.class, jar -> {
jar.setDescription("Assembles a jar archive containing the main classes.");
jar.setGroup(BasePlugin.BUILD_GROUP);
jar.from(mainSourceSetOf(pluginConvention).getOutput());
});
}