2016-11-13 123 views
0

我正在嘗試使用WildFly Swarm構建Web應用程序服務器,並且該應用程序必須能夠運行其他Java程序(我不想將其作爲一個外部過程)。我想包括外部程序作爲的.jar依賴我的web應用程序,但是,wildfly-羣包任務總是失敗,出現以下:WildFly Swarm + War + Gradle中的本地Jar依賴關係--NullPointerException

:clean 
:compileJava 
:processResources UP-TO-DATE 
:classes 
:war 
:wildfly-swarm-package FAILED 

FAILURE: Build failed with an exception. 

* What went wrong: 
Execution failed for task ':wildfly-swarm-package'. 
> java.lang.NullPointerException (no error message) 

這是我gradle.build文件:

buildscript { 
    version = System.getProperty('swarmVersion') ?: '2016.10.0' 

    repositories { 
    mavenLocal() 
    mavenCentral() 
    } 

    dependencies { 
    classpath "io.spring.gradle:dependency-management-plugin:0.5.6.RELEASE" 
    classpath "org.wildfly.swarm:wildfly-swarm-plugin:$version" 
    } 
} 

apply plugin: "io.spring.dependency-management" 
apply plugin: 'wildfly-swarm' 
apply plugin: 'java' 
apply plugin: 'application' 
apply plugin: 'war' 

//mainClassName = 'org.siret.prank.webapp.rest.Main' 

swarm { 
    properties { 
    swarm.http.port = 8181 
    } 
} 

repositories { 
    mavenLocal() 
    mavenCentral() 
    maven { 
    url 'https://maven.repository.redhat.com/nexus/content/repositories/releases/' 
    } 
    maven { 
    url 'https://maven.repository.redhat.com/nexus/content/repositories/thirdparty-releases/' 
    } 
    flatDir { 
     dirs 'libs' 
    } 
} 

dependencyManagement { 
    imports { 
    mavenBom "org.wildfly.swarm:bom-all:$version" 
    } 
} 

dependencies { 
    compile group: 'org.biojava', name: 'biojava-core', version: '4.2.4' 
    compile group: 'org.biojava', name: 'biojava-structure', version: '4.2.4' 
    compile "org.wildfly.swarm:jaxrs" 
    compile group: 'org.wildfly.swarm', name: 'undertow', version: '2016.10.0' 
    compile 'org.codehaus.groovy:groovy-all:2.4.7' 
    compile fileTree(dir: 'libs', include: ['*.jar']) 
    compile fileTree(dir: 'libs/lib', include: ['*.jar']) 
} 

task debugJar(dependsOn:"wildfly-swarm-package") << { 
    javaexec { 
    main="-jar"; 
    args=[ 
      "-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5006", 
      "build/libs/prank-webapp-swarm.jar" 
    ] 
    } 
} 

task runJar(dependsOn:"wildfly-swarm-package") << { 
    javaexec { 
    main="-jar"; 
    args=[ 
      "build/libs/prank-webapp-swarm.jar" 
    ] 
    } 
} 

戰爭插件工作正常,我可以在歸檔中的WEB-INF/lib目錄中找到JAR。

作爲一個實驗,我試圖清空libs文件夾,錯誤仍然存​​在。

感謝, 盧卡斯

+0

不幸的是,我們對Gradle插件的支持並不是很好,因爲我們都是Maven用戶,所以我們都不熟悉它。 WF Swarm內部正在執行的程序是什麼?也許有不同的方法? – Ken

回答