How to create a fat JAR with Gradle Kotlin script?

Here is a version that does not use a plugin, more like the Groovy version. import org.gradle.jvm.tasks.Jar val fatJar = task(“fatJar”, type = Jar::class) { baseName = “${project.name}-fat” manifest { attributes[“Implementation-Title”] = “Gradle Jar File Example” attributes[“Implementation-Version”] = version attributes[“Main-Class”] = “com.mkyong.DateUtils” } from(configurations.runtime.map({ if (it.isDirectory) it else zipTree(it) })) with(tasks[“jar”] as CopySpec) } tasks … Read more

Error:Execution failed for task ‘:app:compileDebugKotlin’. > Compilation error. See log for more details

I got such error after a simple try of code refactoring. It has happened nor after some library was connected neither any changes in gradle. It looked like something in my code was wrong but the compiler could not found the issue. That’s why I double checked all changes that I did and found that … Read more

How do I exclude all instances of a transitive dependency when using Gradle?

Ah, the following works and does what I want: configurations { runtime.exclude group: “org.slf4j”, module: “slf4j-log4j12” } It seems that an Exclude Rule only has two attributes – group and module. Hence for excluding from only an individual dependency, we can do something like: dependencies { compile (‘org.springframework.data:spring-data-hadoop-core:2.0.0.M4-hadoop22’) { exclude group: “org.slf4j”, module: “slf4j-log4j12” } … Read more