Gradle built jar does not find my main class - gradle

At work we use gradle on a Scalding project and I'm trying to come up with the simplest job to get the hand out of the stack.
My class looks as :
package org.playground
import com.twitter.scalding._
class readCsv(args: Args) extends Job(args) {
val csv:Csv = Csv(args("input"), ("firstName", "lastName"))
println(csv)
}
and lives in playground/src/org/playground/readCsv.scala. My build script looks like this:
apply plugin: 'scala'
archivesBaseName = 'playground'
mainClassName = 'org.playground.readCsv'
repositories {
mavenLocal()
mavenCentral()
maven{
url 'http://conjars.org/repo/'
artifactUrls 'http://clojars.org/repo/‎'
artifactUrls 'http://maven.twttr.com/'
}
}
dependencies {
compile 'org.scala-lang:scala-compiler:2.9.2'
compile 'org.scala-lang:scala-library:2.9.2'
compile 'bixo:bixo-core:0.9.1'
compile 'org.apache.hadoop:hadoop-core:1.2.1'
compile 'com.twitter:scalding_2.9.2:0.8.1'
compile 'cascading:cascading-core:2.1.6'
compile 'cascading:cascading-hadoop:2.1.6'
testCompile 'org.testng:testng:6.8.7'
testCompile 'org.scala-tools.testing:specs:1.6.2.2_1.5.0'
}
test {
useTestNG()
}
jar {
description = "Assembles a Hadoop-ready JAR file"
manifest {
attributes( "Main-Class": "org.playground.readCsv" )
}
}
This compiles and builds successfully but trying to run the jar throws this error:
$ java -jar build/libs/playground.jar
Exception in thread "main" java.lang.NoClassDefFoundError: org/playground/readCsv
Caused by: java.lang.ClassNotFoundException: org.playground.readCsv
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
My educated guess is that having the job extend from Job fails to conform some convention and doesn't look like a valid Main-Class, but I won't expect it to complain about not finding it.
Other possibility is that running it as java -jar jarname is incorrect and I just need run it with hadoop or something along those lines.
Anyway and just to validate: What is wrong with my setup?

The source file is in the wrong location. By default, it needs to go into src/main/scala/org/playground/readCsv.scala. Otherwise, it won't even get compiled.

Related

Error while trying to get build script read the java file - Could not resolve all artifacts for configuration ':classpath'

I'm trying to follow this by adding my own custom java file into the classpath
https://github.com/gigaSproule/swagger-gradle-plugin#model-converters
This is shown in the example above
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.custom:model-converter:1.0.0'
}
}
...
swagger {
apiSource {
...
modelConverters = [ 'com.custom.model.Converter' ]
}
}
This is my code
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath("com.test.app.profile.component.MyOpenApiCustomiser:1.0.0")
}
}
swagger {
apiSource {
...
modelConverters = [ 'com.test.app.profile.component.MyOpenApiCustomiser' ]
}
}
This is the error I'm getting
A problem occurred configuring root project 'profile'.
> Could not resolve all artifacts for configuration ':classpath'.
> Could not find com.test.app.profile.component.MyOpenApiCustomiser:1.0.0:.
Required by:
project :
Possible solution:
- Declare repository providing the artifact, see the documentation at https://docs.gradle.org/current/userguide/declaring_repositories.html
I tried removing 1.0.0
Caused by: org.gradle.api.IllegalDependencyNotation: Supplied String module notation 'com.test.app.profile.component.MyOpenApiCustomiser' is invalid. Example notations: 'org.gradle:gradle-core:2.2', 'org.mockito:mockito-core:1.9.5:javadoc'
Not sure how I would get my build script to the use the MyOpenApiCustomiser in my spring boot application
Is there any other way or how to fix this?
The classpath dependency given in the buildscript.dependencies {} block needs to be a external library, given in the standard group:modulde:version notation; in the example from github project it's "com.custom : model-converter : 1.0.0" ( it's a "fake" library, does not really exist in maven central repo, it's just an example)
In your case, it seems you try to refer your class MyOpenApiCustomiser as the classpath library , which cannot work. It needs to be a real library.
If you want to use your own Converter, you'll need to implement it in another library/module, publish it to a private repository and then consume it in your buildscript classpath.
Another simpler way, would be to implement this converter as a class within the buildSrc project: these classes will then be automatically available in your build script classpath, and you can use it in the apiSource configuration.
Sample:
In your buildSrc project
build.gradle
plugins {
id("java")
}
repositories {
mavenCentral()
}
dependencies {
implementation "io.swagger:swagger-core:1.6.2"
}
Your custom ModelConverter class goes under src/main/java, e.g. com.sample.MyCustomConverter
In your root build.gradle script:
You can reference your MyCustomConverter class, it's already available in the script classpath, no need to define a classpath dependency in buildscript
swagger {
apiSource {
modelConverters = [ 'com.sample.MyCustomConverter' ]
// ....

Build Gradle with Modules so Java does not require arguments to execute

I am building a TornadoFx (JavaFX for Kotlin) application. I never had a problem running the application with gradle, but building it into a jar and executing said jar has been a struggle.
Through much trial and error, I have found that I cannot simply run java -jar App.jar, but instead I have to add the following arguments to add in the proper dependencies for JavaFX --module-path /usr/share/openjfx/lib/ --add-modules javafx.controls. But I would like to implement this through gradle, so that these modules are bundled with the jar so that it can be distributed and used by others much nicer.
I have tried to add the JavaFX dependencies 2 different ways, but neither worked:
Implementing the OpenJFX maven artifacts as dependencies
Adding includeBuild("/usr/share/openjfx/lib") to settings.gradle.kts
Thank you to anyone who is able to help out.
Below are all the details of the application and build process:
JDK 1.8
Kotlin 1.4.32
Gradle Kotlin DSL
Source Code: GitHub
Here is my build.gradle.kts
import no.tornado.fxlauncher.gradle.FXLauncherExtension
buildscript {
repositories {
mavenCentral()
}
}
plugins {
application
kotlin("jvm") version "1.4.32"
id("no.tornado.fxlauncher") version "1.0.20"
}
group = "com.jtschwartz"
version = "1.0.0"
val kotlinVersion: String by rootProject
val tornadoFxVersion: String by rootProject
repositories {
mavenCentral()
}
application {
mainClassName = "com.jtschwartz.scratchpad.ScratchpadKt"
}
configure<FXLauncherExtension> {
applicationVendor = "Jacob Schwartz (jacob#jtschwartz.com)"
applicationUrl = "https://storage.googleapis.com/jts-scratchpad-bucket"
applicationMainClass = application.mainClassName
applicationVersion = "1.0.2"
applicationTitle = "Scratchpad"
applicationName = "Scratchpad"
}
dependencies {
platform("org.jetbrains.kotlin:kotlin-bom")
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlinVersion")
implementation("org.jetbrains.kotlin:kotlin-reflect:$kotlinVersion")
implementation("no.tornado:tornadofx:$tornadoFxVersion")
testImplementation("org.jetbrains.kotlin:kotlin-test-junit:$kotlinVersion")
}
tasks {
compileKotlin {
kotlinOptions.jvmTarget = "1.8"
}
compileTestKotlin {
kotlinOptions.jvmTarget = "1.8"
}
}
tasks.withType<Jar> {
manifest {
attributes["Main-Class"] = application.mainClassName
}
from(configurations.compileClasspath.get().map {if (it.isDirectory) it else zipTree(it)})
}
tasks.register<Exec>("deployToGCP") {
dependsOn("embedApplicationManifest")
commandLine("gsutil", "cp", "-r", "./build/libs", "gs://jts-scratchpad-bucket")
}
And this is the error I receive when java -jar App.jar is run without the necessary module arguments:
Exception in thread "main" java.lang.NoClassDefFoundError: javafx/application/Application
at java.base/java.lang.ClassLoader.defineClass1(Native Method)
at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1017)
at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:174)
at java.base/jdk.internal.loader.BuiltinClassLoader.defineClass(BuiltinClassLoader.java:800)
at java.base/jdk.internal.loader.BuiltinClassLoader.findClassOnClassPathOrNull(BuiltinClassLoader.java:698)
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClassOrNull(BuiltinClassLoader.java:621)
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:579)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
at java.base/java.lang.ClassLoader.defineClass1(Native Method)
at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1017)
at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:174)
at java.base/jdk.internal.loader.BuiltinClassLoader.defineClass(BuiltinClassLoader.java:800)
at java.base/jdk.internal.loader.BuiltinClassLoader.findClassOnClassPathOrNull(BuiltinClassLoader.java:698)
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClassOrNull(BuiltinClassLoader.java:621)
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:579)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
at com.jtschwartz.scratchpad.ScratchpadKt.main(Scratchpad.kt:126)
Caused by: java.lang.ClassNotFoundException: javafx.application.Application
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
... 19 more

Error with Building Fatjar Using Kotlin DSL

I am trying to build a fatjar using ShadowJar. My app and gradle code are below. I'm using Gradle 5.0 for the build. When I run ./gradlew run, the code works. When I run 'gradle shadowjar', and run the fatjar using 'java -jar' in the 'build/lib' folder, I get the below error.
I'm guessing the dependencies are not getting loaded in the fatjar? I have also used Groovy to build the Gradle file, and I get the same error.
Am I correct in that I am not including all of the dependencies in the fatjar file? If that is the case, any idea on how to modify the Gradle file to make sure this is included?
Gradle Kotlin DSL
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
// Apply the Kotlin JVM plugin to add support for Kotlin on the JVM.
id("org.jetbrains.kotlin.jvm").version("1.3.21")
id("com.github.johnrengelman.shadow") version "5.0.0"
// Apply the application plugin to add support for building a CLI application.
application
}
repositories {
// Use jcenter for resolving your dependencies.
// You can declare any Maven/Ivy/file repository here.
jcenter()
mavenCentral()
}
dependencies {
// Use the Kotlin JDK 8 standard library.
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8")
// Use the Kotlin test library.
testImplementation("org.jetbrains.kotlin:kotlin-test")
// Use the Kotlin JUnit integration.
testImplementation("org.jetbrains.kotlin:kotlin-test-junit")
implementation("org.http4k:http4k-core:3.143.1")
implementation("org.http4k:http4k-server-jetty:3.143.1")
implementation("org.http4k:http4k-client-okhttp:3.143.1")
implementation("org.http4k:http4k-client-apache:3.143.1")
}
tasks.withType<KotlinCompile> {
kotlinOptions.jvmTarget = "1.8"
}
application {
// Define the main class for the application.
mainClassName = "com.benito.AppKt"
}
tasks.withType<ShadowJar> {
archiveBaseName.set("${project.name}-all")
}
Kotlin Code
import org.http4k.core.HttpHandler
import org.http4k.core.Method
import org.http4k.core.Request
import org.http4k.core.Response
import org.http4k.core.Status.Companion.OK
import org.http4k.routing.bind
import org.http4k.routing.path
import org.http4k.routing.routes
import org.http4k.server.Jetty
import org.http4k.server.asServer
fun main(args: Array<String>) {
println("Starting")
val app: HttpHandler = routes(
"/ping" bind Method.GET to { _: Request -> Response(OK).body("pong!") },
"/greet/{name}" bind Method.GET to { req: Request ->
val path: String? = req.path("name")
Response(OK).body("hello ${path ?: "anon!"}")
}
)
app.asServer(Jetty(8080)).start()
}
Error Message
2019-05-15 11:15:13.925:INFO::main: Logging initialized #287ms to org.eclipse.jetty.util.log.StdErrLog
2019-05-15 11:15:14.039:INFO:oejs.Server:main: jetty-9.4.z-SNAPSHOT; built: 2019-04-29T20:42:08.989Z; git: e1bc35120a6617ee3df052294e433f3a25ce7097; jvm 1.8.0_211-b12
Exception in thread "main" java.lang.ExceptionInInitializerError
at org.eclipse.jetty.http.MimeTypes$Type.<init>(MimeTypes.java:103)
at org.eclipse.jetty.http.MimeTypes$Type.<clinit>(MimeTypes.java:58)
at org.eclipse.jetty.http.MimeTypes.<clinit>(MimeTypes.java:191)
at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:836)
at org.eclipse.jetty.servlet.ServletContextHandler.doStart(ServletContextHandler.java:278)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:167)
at org.eclipse.jetty.server.Server.start(Server.java:418)
at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:110)
at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:113)
at org.eclipse.jetty.server.Server.doStart(Server.java:382)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
at org.http4k.server.Jetty$toServer$3.start(jetty.kt:33)
at com.benito.AppKt.main(App.kt:38)
Caused by: java.lang.ArrayIndexOutOfBoundsException: 1
at org.eclipse.jetty.http.PreEncodedHttpField.<clinit>(PreEncodedHttpField.java:70)
... 14 more
The problem here is that during the process of merging all the JARs in to one FatJAR, the contents of the META-INF folder in the http4k-core JAR (which contains the mime.types file used for matching a request to a content type) is somehow omitted or overridden by the merging process.
This isn't http4k specific and is (quite) a common problem with the use of the shadow-jar gradle plugin. But it can be easily solved by just correctly configuring the plugin as below:
shadowJar {
mergeServiceFiles() // <-- this!
}
From the http4k side, the exception message generated has been changed to highlight this problem.

Gradle Spring Boot Project Cannot Run From IDEA [duplicate]

This question already has answers here:
NoClassDefFoundError after IntelliJ IDEA upgrade
(3 answers)
Closed 5 years ago.
I am struggling to set up the spring boot project that i have imported in intelliJ IDEA 2016 1.4.
Every time i run . I get the below Exception:
Exception in thread "main" java.lang.NoClassDefFoundError: org/springframework/boot/SpringApplication
at com.patientConnect.DemoApplication.main(DemoApplication.java:24)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)
Caused by: java.lang.ClassNotFoundException: org.springframework.boot.SpringApplication
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 6 more
My gradle settings (linked gradle projects,user gradle wrapper ) all looks good.
package com.Demo;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
#SpringBootApplication
public class DemoApplication {
public DemoApplication() {
}
public static void main(String[] args) {
SpringApplication.run(DemoApplication.class, args);
}
}
build.gradle:
buildscript {
repositories {
mavenLocal()
mavenCentral()
maven {
url 'https://plugins.gradle.org/m2/'
}
}
dependencies {
classpath 'org.springframework.boot:spring-boot-gradle-plugin:1.4.2.RELEASE'
classpath 'gradle.plugin.com.jamesward:atom-gradle-plugin:0.0.1'
}
}
apply plugin: 'java'
apply plugin: 'org.springframework.boot'
repositories {
mavenLocal()
mavenCentral()
}
dependencies {
compile 'org.springframework.boot:spring-boot-starter-parent:1.5.4.RELEASE'
compile 'org.springframework.boot:spring-boot-starter-web'
compile 'org.springframework.boot:spring-boot-devtools'
compile 'org.springframework.boot:spring-boot-starter-security'
compile 'org.springframework.security.oauth:spring-security-oauth2'
compile 'org.apache.httpcomponents:httpclient'
compile 'org.springframework.boot:spring-boot-starter-data-jpa'
compile 'org.postgresql:postgresql'
compile 'org.springframework.boot:spring-boot-starter-jdbc'
compile 'org.hibernate:hibernate-entitymanager'
}
allprojects {
sourceCompatibility = 1.8
targetCompatibility = 1.8
}
import org.gradle.internal.os.OperatingSystem
task devClasses(type: Exec) {
if (OperatingSystem.current().isWindows())
commandLine 'gradlew', '-t', 'classes'
else
commandLine './gradlew', '-t', 'classes'
}
task devBootRun(type: Exec) {
if (OperatingSystem.current().isWindows())
commandLine 'gradlew', 'bootRun'
else
commandLine './gradlew', 'bootRun' //, '--debug-jvm'
}
import java.util.concurrent.*
task dev() << {
def devClassesFuture = Executors.newSingleThreadExecutor().submit({ devClasses.execute() } as Callable)
def devBootRunFuture = Executors.newSingleThreadExecutor().submit({ devBootRun.execute() } as Callable)
devClassesFuture?.get()
devBootRunFuture?.get()
}
task stage {
dependsOn build
}
Try deleting your SpringBoot dependency on your computer.
It will be located at ~/.gradle/caches/modules-2/files-2.1/org.springframework.boot Assuming you kept your gradle dependencies in the default location.
rm -rf ~/.gradle/caches/modules-2/files-2.1/org.springframework.boot
or to delete all dependencies (Just to be sure if no other dependencies is corrupted)
rm -rf ~/.gradle/caches/modules-2/files-2.1/*
then to re-download
gradle build --refresh-dependencies

Neo4j "No dependency satisfies type class org.neo4j.kernel.api.index.SchemaIndexProvider"

Neo4j Community 2.3.3 Linux (Ubuntu 14.04)
Trying to run a Java app which consumes a Kafka topic, process its messages while querying Neo4j, and writes them to another Kafka topic.
hduser#ubuntu:~$ java -jar gradle1-0.1.0.jar localhost:9092 musicgrp raw-events enriched-events bad-events /home/ubuntu/GeoLiteCity.dat
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
Exception in thread "main" java.lang.RuntimeException: Error starting org.neo4j.kernel.impl.factory.CommunityFacadeFactory, /home/hduser/neo4jdb2/data/graph.db
at org.neo4j.kernel.impl.factory.GraphDatabaseFacadeFactory.newFacade(GraphDatabaseFacadeFactory.java:143)
at org.neo4j.kernel.impl.factory.CommunityFacadeFactory.newFacade(CommunityFacadeFactory.java:43)
at org.neo4j.kernel.impl.factory.GraphDatabaseFacadeFactory.newFacade(GraphDatabaseFacadeFactory.java:108)
at org.neo4j.graphdb.factory.GraphDatabaseFactory.newDatabase(GraphDatabaseFactory.java:129)
at org.neo4j.graphdb.factory.GraphDatabaseFactory$1.newDatabase(GraphDatabaseFactory.java:117)
at org.neo4j.graphdb.factory.GraphDatabaseBuilder.newGraphDatabase(GraphDatabaseBuilder.java:185)
at music.StreamApp.main(StreamApp.java:40)
Caused by: org.neo4j.kernel.lifecycle.LifecycleException: Component 'org.neo4j.kernel.NeoStoreDataSource#1d606256' was successfully initialized, but failed to start. Please see attached cause exception.
at org.neo4j.kernel.lifecycle.LifeSupport$LifecycleInstance.start(LifeSupport.java:462)
at org.neo4j.kernel.lifecycle.LifeSupport.start(LifeSupport.java:111)
at org.neo4j.kernel.impl.transaction.state.DataSourceManager.start(DataSourceManager.java:112)
at org.neo4j.kernel.lifecycle.LifeSupport$LifecycleInstance.start(LifeSupport.java:452)
at org.neo4j.kernel.lifecycle.LifeSupport.start(LifeSupport.java:111)
at org.neo4j.kernel.impl.factory.GraphDatabaseFacadeFactory.newFacade(GraphDatabaseFacadeFactory.java:139)
... 6 more
Caused by: org.neo4j.kernel.impl.util.UnsatisfiedDependencyException: No dependency satisfies type class org.neo4j.kernel.api.index.SchemaIndexProvider
at org.neo4j.kernel.impl.util.Dependencies.resolveDependency(Dependencies.java:78)
at org.neo4j.kernel.impl.util.Dependencies.resolveDependency(Dependencies.java:74)
at org.neo4j.kernel.NeoStoreDataSource.start(NeoStoreDataSource.java:507)
at org.neo4j.kernel.lifecycle.LifeSupport$LifecycleInstance.start(LifeSupport.java:452)
... 11 more
This is my gradle.build, I read some post about keeping Neo4j jars out of the bundle ... by pointing to its jars with --classpath ... I'm new to Gradle, is this relevant ?
apply plugin: 'java'
apply plugin: 'application'
sourceCompatibility = '1.8'
mainClassName = 'music.StreamApp'
repositories {
mavenCentral()
}
version = '0.1.0'
dependencies {
compile 'org.apache.kafka:kafka-clients:0.9.0.0'
compile 'com.maxmind.geoip:geoip-api:1.2.14'
compile 'com.fasterxml.jackson.core:jackson-databind:2.6.3'
compile 'org.slf4j:slf4j-api:1.7.5'
compile 'org.neo4j:neo4j:2.3.3'
}
jar { // c
manifest {
attributes 'Main-Class': mainClassName
}
from {
configurations.compile.collect {
it.isDirectory() ? it : zipTree(it)
}
} {
exclude "META-INF/*.SF"
exclude "META-INF/*.DSA"
exclude "META-INF/*.RSA"
}
}
My suspicion is that you don't have the META-INF/services/org.neo4j.kernel.extension.KernelExtensionFactory files in your jar correctly. Internally Neo4j uses JVM's ServiceLoader to load its components.
See https://github.com/neo4j/neo4j/blob/2.3/community/lucene-index/src/main/resources/META-INF/services/org.neo4j.kernel.extension.KernelExtensionFactory for the potentially missing piece.
I assume the right way to solve this is not by changing Gradle's default jar task, instead use a plugin that handles META-INF files correctly. I've made some good experiences with the shadow plugin.
In my case (Neo4j Shell Tools 3.0.3, Gradle 2.13), adding mergeServiceFiles() was the key for resolving this issue:
plugins { id "com.github.johnrengelman.shadow" version "1.2.3" }
shadowJar {
classifier = 'fat'
mergeServiceFiles()
manifest { attributes 'Main-Class': '...' }
}
There was no need to specify the exact file (META-INF/...).

Resources