测试失败,无法找到本地图像

时间:2019-10-22 03:45:18

标签: java gradle quarkus graalvm graalvm-native-image

我正在尝试将Quarkus Web服务器集成到Gradle多构建项目中。我一直遵循设置Quarkus服务的典型指南,但是遇到一个我无法弄清楚该如何解决的问题。此时,我正在尝试运行默认设置(使用默认代码和测试)

运行测试时,我收到一条错误消息,说Unable to find native image, make sure native.image.path is set

我认为这是一个配置或相关性问题,但是由于我是Quarkus的新手,所以我不知道如何解决它,并且似乎对Gradle的支持还很缺乏...

我相信我已经正确设置了GraalVM(使用本地图像可执行文件)。

Project, in case you want to dig.如果有什么可以在这里包括的内容,请告诉我。

子项目的build.gradle:

plugins {
    id 'java'
    id 'io.quarkus' version '0.26.0'
}
//apply plugin: 'io.quarkus'

version = '0.0.0.63'

sourceCompatibility = 1.8

repositories {
    mavenCentral()
}

dependencies {
    compile project(":BaseCode")

    implementation enforcedPlatform('io.quarkus:quarkus-bom:0.26.0')
    implementation 'io.quarkus:quarkus-resteasy'
    implementation 'io.quarkus:quarkus-resteasy-jackson'
    //implementation 'io.quarkus:quarkus-jackson'
    //implementation 'io.quarkus:quarkus-elytron-security'

    testImplementation 'io.quarkus:quarkus-junit5'
    testCompile group: 'io.rest-assured', name: 'rest-assured', version: '3.3.0'
}

test {
    useJUnitPlatform()
}

compileJava {
    println "WebServer version at compile time: " + version
    dependsOn ':BaseCode:test'
    dependsOn 'incrementBuildVersion';
}

失败消息:

Starting process 'Gradle Test Executor 29'. Working directory: /home/greg/GitRepos/task-timekeeper/WebServer Command: /usr/lib/jvm/java-11-oracle/bin/java -Dorg.gradle.native=false @/tmp/gradle-worker-classpath17037522129690074442txt -Xmx512m -Dfile.encoding=UTF-8 -Duser.country=US -Duser.language=en -Duser.variant -ea worker.org.gradle.process.internal.worker.GradleWorkerMain 'Gradle Test Executor 29'
Successfully started process 'Gradle Test Executor 29'
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.codehaus.groovy.vmplugin.v7.Java7$1 (file:/home/greg/.gradle/caches/modules-2/files-2.1/org.codehaus.groovy/groovy/2.5.6/6936e700f0fb1b50bac0698ada4347a769d40199/groovy-2.5.6.jar) to constructor java.lang.invoke.MethodHandles$Lookup(java.lang.Class,int)
WARNING: Please consider reporting this to the maintainers of org.codehaus.groovy.vmplugin.v7.Java7$1
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release

Gradle Test Executor 29 STANDARD_OUT
    2019-10-21 23:27:02,366 DEBUG [Test worker] (org.jboss.logging.LoggerProviders.logProvider(LoggerProviders.java:158)                                                      ) - Logging Provider: org.jboss.logging.Log4j2LoggerProvider


org.acme.rest.json.LegumeResourceIT > testList() FAILED
    org.junit.jupiter.api.extension.TestInstantiationException: TestInstanceFactory [io.quarkus.test.junit.QuarkusTestExtension] failed to instantiate test class [org.acme.rest.json.LegumeResourceIT]: Unable to find native image, make sure native.image.path is set

        Caused by:
        java.lang.RuntimeException: Unable to find native image, make sure native.image.path is set

org.acme.rest.json.FruitResourceIT > testAdd() SKIPPED

org.acme.rest.json.FruitResourceIT > testList() SKIPPED

org.acme.rest.json.LegumeResourceTest > testList() SKIPPED

org.acme.rest.json.FruitResourceTest > testAdd() SKIPPED

org.acme.rest.json.FruitResourceTest > testList() SKIPPED

6 tests completed, 1 failed, 5 skipped
Finished generating test XML results (0.0 secs) into: /home/greg/GitRepos/task-timekeeper/WebServer/build/test-results/test
Generating HTML test report...
Finished generating test html results (0.0 secs) into: /home/greg/GitRepos/task-timekeeper/WebServer/build/reports/tests/test
:WebServer:test (Thread[Execution worker for ':',5,main]) completed. Took 1.544 secs.

FAILURE: Build failed with an exception.

0 个答案:

没有答案