我正在尝试使用 WildFly Swarm 构建一个 Web 应用程序服务器,并且该应用程序必须能够在内部运行另一个 Java 程序(我不想将它作为外部进程运行)。我正在尝试将外部程序作为 .jar 依赖项包含到我的 Web 应用程序中,但是,wildfly-swarm-package 任务总是失败并显示以下内容:
: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"
]
}
}
War 插件工作正常,我可以在存档的 WEB-INF/lib 目录中找到 jars。
作为实验,我尝试清空 libs 文件夹,但错误仍然存在。
谢谢,卢卡斯