2017-04-06 25 views
2

私はGradle Supportプラグイン1.3.8でNetbeans 8.0.2を使用しています。Gradle:設定 ':コンパイル'の依存関係を解決できません。

私は、タスクを実行すると、以下のようにしかし、それはライン38(compile group行)でエラーを表示し、いくつかのシグネチャファイルを除外しながら、ユーバー - ジャーを生成するためのタスクを追加しました:

apply plugin: 'java' 
apply plugin: 'application' 

mainClassName = 'br.com.myproject.Sample' 
sourceCompatibility = '1.8' 
[compileJava, compileTestJava]*.options*.encoding = 'UTF-8' 
version='1.0.0' 

// For DEBUG to work 
ext.mainClass = mainClassName 

task uniqueJar(type: Jar) { 
    baseName = project.name 

    from(configurations.compile.collect { it.isDirectory() ? it : zipTree(it) }) { 
     exclude "META-INF/*.SF" 
     exclude "META-INF/*.DSA" 
     exclude "META-INF/*.RSA" 
    } 

    manifest { 
     attributes 'Implementation-Title': project.name, 
       'Implementation-Version': version, 
       'Main-Class': mainClassName 
    } 
    with jar 
} 

repositories { 
    mavenCentral() 
    // You may define additional repositories, or even remove "mavenCentral()". 
    // Read more about repositories here: 
    // http://www.gradle.org/docs/current/userguide/dependency_management.html#sec:repositories 
} 

dependencies { 
    // https://mvnrepository.com/artifact/org.eclipse.paho/org.eclipse.paho.client.mqttv3 
    compile group: 'org.eclipse.paho', name: 'org.eclipse.paho.client.mqttv3', version: '1.1.1' // line 38 


    testCompile group: 'junit', name: 'junit', version: '4.10' 
} 

エラーメッセージ:

実行:Gradleのユニークなジャー引数:[uniqueJar、-c、 D:\ NetBeansProjects \ testeMqtt \ settings.gradle]

FAILURE:ビルド失敗例外を伴うed。

  • :ファイルをビルド 'D:\ NetBeansProjects \ testeMqtt \のbuild.gradle' 行:38

  • 何が間違っていた:問題は、ルートプロジェクト 'testeMqtt' を評価起こりました。

    設定 ':コンパイル'の依存関係を解決できません。

  • 試行:スタックトレースを取得するには、--stacktraceオプションを指定して実行してください。より多くのログ出力を得るには、--infoまたは--debugオプションを指定して実行します。

BUILDは

合計時間をFAILED:0.102秒

にはどうすればユーバー-ジャータスクを修正できますか?

答えて

2

は特級ジャー生成するためのShadow gradle plugin使用して私の問題を解決:

apply plugin: 'java' 
apply plugin: 'application' 

mainClassName = 'br.com.myproject.Sample' 
sourceCompatibility = '1.8' 
[compileJava, compileTestJava]*.options*.encoding = 'UTF-8' 
version='1.0.0' 

// For DEBUG to work 
ext.mainClass = mainClassName 

repositories { 
    mavenCentral() 
} 

dependencies { 
    compile 'org.eclipse.paho:org.eclipse.paho.client.mqttv3:1.1.1' 
    testCompile group: 'junit', name: 'junit', version: '4.10' 
} 

buildscript { 
    repositories { 
     jcenter() 
    } 
    dependencies { 
     classpath 'com.github.jengelman.gradle.plugins:shadow:1.2.4' 
    } 
} 

apply plugin: 'com.github.johnrengelman.shadow'