uberjar

How to specify the entry point, Main-Class, for a FatJar using Gradle Kotlin DSL?

跟風遠走 提交于 2019-12-02 09:20:52
How do I specify the Main-Class attribute in the ShadowJar once it's imported ? import org.jetbrains.kotlin.gradle.tasks.KotlinCompile import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar plugins { kotlin("jvm") version "1.2.51" id("com.github.johnrengelman.shadow") version "2.0.4" } group = "xxx.yyy" version = "1.0-SNAPSHOT" repositories { mavenCentral() } dependencies { implementation(kotlin("stdlib-jdk8")) } tasks.withType<KotlinCompile> { kotlinOptions.jvmTarget = "1.8" } tasks.withType<ShadowJar> { baseName = "app" classifier = "inajar" version = "9" //main-class = "foobar" }

Create standalone jar using SBT

巧了我就是萌 提交于 2019-11-29 20:35:14
I was a heavy Maven user and now I'm gradually using SBT for some of my projects. I'd like to know how could I use SBT to create a standalone Java project? This project should be packaged as a JAR file and this JAR file would be used as a dependency in another SBT project. In Maven, I could tell in my pom.xml what type of artifact it should produce when I build it. Is there something similar that I can do in SBT? There is a difference between standalone and making a project useable as a dependency or another project. In the first case, you would use a plugin such as sbt-assembly . What it will

Using Maven shade plugin in a multi module project - NullPointerException

只谈情不闲聊 提交于 2019-11-29 01:50:13
I have a scenario where-in I need to create an uber jar of a multi module maven project including all modules and their dependencies. I tried using maven shade plugin. but it seems to work only when I use it at the module level. If I add the plugin entry in parent pom then the build breaks (it tries to shade the parent pom) [INFO] Replacing original artifact with shaded artifact. [INFO] Replacing null with C:\Projects\foo.bar\target\foobar-0.0.1-SNAPSHOT-shaded.pom [INFO] ------------------------------------------------------------------------ [ERROR] BUILD ERROR [INFO] -----------------------

Create standalone jar using SBT

我只是一个虾纸丫 提交于 2019-11-28 16:38:05
问题 I was a heavy Maven user and now I'm gradually using SBT for some of my projects. I'd like to know how could I use SBT to create a standalone Java project? This project should be packaged as a JAR file and this JAR file would be used as a dependency in another SBT project. In Maven, I could tell in my pom.xml what type of artifact it should produce when I build it. Is there something similar that I can do in SBT? 回答1: There is a difference between standalone and making a project useable as a

Using Maven shade plugin in a multi module project - NullPointerException

随声附和 提交于 2019-11-27 16:10:27
问题 I have a scenario where-in I need to create an uber jar of a multi module maven project including all modules and their dependencies. I tried using maven shade plugin. but it seems to work only when I use it at the module level. If I add the plugin entry in parent pom then the build breaks (it tries to shade the parent pom) [INFO] Replacing original artifact with shaded artifact. [INFO] Replacing null with C:\Projects\foo.bar\target\foobar-0.0.1-SNAPSHOT-shaded.pom [INFO] --------------------

Why does format(“kafka”) fail with “Failed to find data source: kafka.” (even with uber-jar)?

懵懂的女人 提交于 2019-11-27 15:09:17
I use HDP-2.6.3.0 with Spark2 package 2.2.0. I'm trying to write a Kafka consumer, using the Structured Streaming API, but I'm getting the following error after submit the job to the cluster: Exception in thread "main" java.lang.ClassNotFoundException: Failed to find data source: kafka. Please find packages at http://spark.apache.org/third-party-projects.html at org.apache.spark.sql.execution.datasources.DataSource$.lookupDataSource(DataSource.scala:553) at org.apache.spark.sql.execution.datasources.DataSource.providingClass$lzycompute(DataSource.scala:89) at org.apache.spark.sql.execution

gradle - how do I build a jar with a lib dir with other jars in it?

笑着哭i 提交于 2019-11-27 10:39:09
In gradle - how can I embed jars inside my build output jar in the lib directory (specifially the lib/enttoolkit.jar and lib/mail.jar)? Lifted verbatim from: http://docs.codehaus.org/display/GRADLE/Cookbook#Cookbook-Creatingafatjar Gradle 0.9: jar { from configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } } Gradle 0.8: jar.doFirst { for(file in configurations.compile) { jar.merge(file) } } The above snippets will only include the compile dependencies for that project, not any transitive runtime dependencies. If you also want to merge those, replace configurations.compile

gradle - how do I build a jar with a lib dir with other jars in it?

家住魔仙堡 提交于 2019-11-26 22:19:45
问题 In gradle - how can I embed jars inside my build output jar in the lib directory (specifially the lib/enttoolkit.jar and lib/mail.jar)? 回答1: Lifted verbatim from: http://docs.codehaus.org/display/GRADLE/Cookbook#Cookbook-Creatingafatjar Gradle 0.9: jar { from configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } } Gradle 0.8: jar.doFirst { for(file in configurations.compile) { jar.merge(file) } } The above snippets will only include the compile dependencies for that project,

Why does format(“kafka”) fail with “Failed to find data source: kafka.” (even with uber-jar)?

不羁岁月 提交于 2019-11-26 17:03:30
问题 I use HDP-2.6.3.0 with Spark2 package 2.2.0. I'm trying to write a Kafka consumer, using the Structured Streaming API, but I'm getting the following error after submit the job to the cluster: Exception in thread "main" java.lang.ClassNotFoundException: Failed to find data source: kafka. Please find packages at http://spark.apache.org/third-party-projects.html at org.apache.spark.sql.execution.datasources.DataSource$.lookupDataSource(DataSource.scala:553) at org.apache.spark.sql.execution

Is it possible to create an “uber” jar containing the project classes and the project dependencies as jars with a custom manifest file?

吃可爱长大的小学妹 提交于 2019-11-26 11:44:40
I'm trying to create a executable jar(using maven) that contains the project classes and it's dependencies with a manifest file that has the entry for the main class and the class path entry that points to the dependencies packed in the root of the jar;something like this : Manifest File: ..... Main-Class : com.acme.MainClass Class-Path : dependecy1.jar dependecy2.jar ..... Jar: jar-root |-- .... |-- com/acme/../*.class |-- dependecy1.jar `-- dependecy2.jar I'm using the maven-jar-plugin to create the manifest file and the maven-shade-plugin to create the "uber" jar but the dependencies are