有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

Gradle NullPointerException中的java WildFly Swarm+War+本地Jar依赖项

我正在尝试使用WildFly Swarm构建一个web应用程序服务器,该应用程序必须能够在内部运行另一个Java程序(我不想将其作为外部进程运行)。我正在尝试将外部程序包括在内。jar依赖于我的web应用程序,但是,wildfly swarm软件包任务总是失败,原因如下:

: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目录中找到JAR

作为实验,我尝试清空libs文件夹,但错误仍然存在

谢谢, 卢卡斯


共 (1) 个答案