【发布时间】:2017-01-19 13:50:50
【问题描述】:
我刚刚将构建脚本转移到使用 gradle-script-kotlin,使用 gradle 3.4 和 gradle-script-kotlin 0.6。
我可以让构建脚本生成一个 jar,但清单不包含主类名。根据我找到的其他帖子,我在最后尝试了 Kt 和 KT 的主类名称。
构建脚本如下:
/*
* Copyright 2017 SixRQ Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
group = "com.sixrq"
version = "1.0-SNAPSHOT"
buildscript {
repositories {
maven { setUrl("http://dl.bintray.com/kotlin/kotlin-eap-1.1") }
gradleScriptKotlin()
}
dependencies {
classpath(kotlinModule("gradle-plugin"))
}
}
plugins {
application
groovy
java
}
apply {
plugin("kotlin")
}
repositories {
maven { setUrl("http://dl.bintray.com/kotlin/kotlin-eap-1.1") }
mavenCentral()
}
dependencies {
compile(kotlinModule("stdlib"))
compile("org.jetbrains.kotlin:kotlin-gradle-plugin:1.1-M04")
compile("org.codehaus.groovy:groovy-all:2.3.11")
compile("com.fasterxml.jackson.module:jackson-module-kotlin:2.7.4")
testCompile("org.spockframework:spock-core:1.0-groovy-2.4")
testCompile("junit:junit:4.11")
}
configure<ApplicationPluginConvention> {
mainClassName = "com.sixrq.kaxb.main.SchemaGenerator"
}
我还想创建一个包含运行时依赖项的胖 jar,我可以看到很多关于 groovy 构建脚本的示例,但对于 gradle-script-kotlin 没有,有什么建议吗?
谢谢
【问题讨论】: