2017-01-19 8 views
0

私はgradle-3.4とgradle-script-kotlin 0.6を使って、gradle-script-kotlinを使うようにビルドスクリプトを移動しました。gradle-script-kotlinを使って実行可能なfat jarファイルを構築する

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ファイルを作成したい、私はgradle-のためのグルーヴィーなビルドスクリプトが、何のためにこの例をたくさん見ることができ、次のように

ビルドスクリプトがありますscript-kotlin、どんな提案?

おかげ

+0

だけ先端を構築Kotlinスクリプトで

import org.gradle.jvm.tasks.Jar 

val jar: Jar by tasks jar.apply { manifest.attributes.apply { put("Main-Class", "com.sixrq.kaxb.main.SchemaGenerator") } } 

を、0.7は昨日出てきました更新したいかもしれません;) – elect

答えて

0

アプリケーションのプラグインは右の場所ではありませんが、これは実行するスクリプトの生成に使用されます。次を使用する必要があるjarファイル内のメインクラスを設定するには:ファイル

関連する問題