I have a two-module application.
I would like to make a task with compiling to Thin Jar version (supposedly this is how the build compiles by default) and Fat Jar (created task with similar name).
triangle-app, is the main app, and I would like in Thin Jar version to have its classes + jar file with triangle-lib in Jar.
Unfortunately, for some reason, both the FatJar task and the build generate a typical Fat Jar in which there are classes from both modules in one file.
My main build.gradle file:
id 'java'
}
group 'pl.com.rbinternational'
version '1.0-SNAPSHOT'
repositories {
mavenCentral()
}
dependencies {
implementation project(':triangle-lib')
}
sourceSets.main.java.srcDirs = ['triangle-app/src']
jar {
manifest {
attributes 'Main-Class': 'pl.com.rbinternational.Main'
}
from {configurations.compile.collect { it.isDirectory() ? it : zipTree(it) }}
}
task FatJar(type: Jar) {
manifest {
attributes 'Main-Class': 'pl.com.rbinternational.Main'
}
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
from { configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) } }
with jar
}
subprojects.each { subproject ->
evaluationDependsOn(subproject.path)
}```