Hi folks,
First-time poster here!
I have been trying to add support for shadow jars (FAT jars) to the existing grpc-java-examples gradle script without much success. Here is the path to the existing gradle file.
All I want is to add support for creating standalone/FAT jars and ensure that the distribution runnable scripts use the FAT jars instead of the list of all dependencies separately.
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
task clientFatJar(type: ShadowJar) {
classifier = "client"
configurations = [ project.configurations.compile ]
from sourceSets.main.output
manifest {
attributes("Main-Class": 'io.grpc.examples.helloworld.HelloWorldClient')
}
}
task helloWorldClient(type: CreateStartScripts) {
mainClassName = 'io.grpc.examples.helloworld.HelloWorldClient'
applicationName = 'hello-world-client'
outputDir = new File(project.buildDir, 'tmp')
//classpath = jar.outputs.files + project.configurations.runtime
classpath = clientFatJar.outputs.files
}
applicationDistribution.into('bin') {
from(helloWorldClient)
fileMode = 0755
}
The above modification works, kind of, in the sense that I can get the startup script to include the classpath as set CLASSPATH=%APP_HOME%\lib\examples-client.jar
i.e. the fat JAR but the script doesn’t work because my install/lib
directory doesn’t include the shadow jars.
I feel that this can be solved by tweaking the applicationDistribution task but unfortunately I can’t seem to get enough out of the documentation to make that change.
Would someoen please help me out here?