【发布时间】:2018-04-27 01:32:36
【问题描述】:
我正在使用 gradle 构建混合 Kotlin 和 Apache Spark 的项目,但是一旦我声明了 spark 依赖项,我生成的 Fat JAR 就无法正常工作。否则它将起作用。源代码甚至没有从 Spark 导入任何东西
buildscript {
ext.kotlin_version = '1.2.40'
repositories {
mavenCentral()
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
apply plugin: 'kotlin'
repositories {
mavenCentral()
}
dependencies {
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
// uncomment this line to get main class 'myownpkg.SparkApplicationKt'
// not found error
// compile 'org.apache.spark:spark-core_2.11:2.3.0'
}
jar {
manifest { attributes 'Main-Class': 'myownpkg.SparkApplicationKt' }
from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } }
}
【问题讨论】:
-
uncomment this line?哪条线? -
我得到了这个有效的添加指令到 jar 部分,它将排除 'META-INF/*'
标签: apache-spark gradle jar kotlin