I'm working on a multi-project gradle setup, where the structure is like below:
pipeline-jobs // root folder
├── gradle.properties
├── settings.gradle
├── build.gradle
└── partition-by-users // sub-project
├── com.client.dataPipelineJobs.partitionByUsers
│ └── PartitionByUsers.java // has the main() method
└── build.gradle
pipeline-jobs is the root project folder and for now I've only one subproject called partition-by-users. In future many more sub-projects will get added. I want to build runnable jars for all these sub-projects. My build.gradle file under partition-by-users sub-project looks like below:
jar {
zip64 = true
manifest {
attributes('Main-Class': 'com.client.dataPipelineJobs.partitionByUsers.PartitionByUsers')
}
from {
configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) }
}
}
Now from the root project dir if I execute gradle jar
command and then run the jar file, it throws the following error:
Could not find or load main class com.client.dataPipelineJobs.partitionByUsers.PartitionByUsers
I'm not able to find out the root cause behind this. What am I missing here? I've tried changing the manifest with attributes('Main-Class': partition-by-users.com.client.dataPipelineJobs.partitionByUsers.PartitionByUsers)
but that didn't help.
Update: I think there's some issue with building the fat-jar. Building the jar without the dependencies solve the problem, but then probably I've find out a different way of preparing the fat-jar.