我正在尝试使用native-image-maven-plugin
来构建Java项目,但出现以下错误:
[ERROR] Failed to execute goal com.oracle.substratevm:native-image-maven-plugin:19.1.0:native-image (default) on project yolo-parent: Execution default of goal com.oracle.substratevm:native-image-maven-plugin:19.1.0:native-image failed: A required class was missing while executing com.oracle.substratevm:native-image-maven-plugin:19.1.0:native-image: jdk/vm/ci/services/Services
[ERROR] -----------------------------------------------------
[ERROR] realm = plugin>com.oracle.substratevm:native-image-maven-plugin:19.1.0
[ERROR] strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
[ERROR] urls[0] = file:/Users/johndoe/.m2/repository/com/oracle/substratevm/native-image-maven-plugin/19.1.0/native-image-maven-plugin-19.1.0.jar
[ERROR] urls[1] = file:/Users/johndoe/.m2/repository/com/oracle/substratevm/svm-driver/19.1.0/svm-driver-19.1.0.jar
[ERROR] urls[2] = file:/Users/johndoe/.m2/repository/com/oracle/substratevm/library-support/19.1.0/library-support-19.1.0.jar
[ERROR] urls[3] = file:/Users/johndoe/.m2/repository/org/graalvm/sdk/graal-sdk/19.1.0/graal-sdk-19.1.0.jar
[ERROR] urls[4] = file:/Users/johndoe/.m2/repository/com/oracle/substratevm/svm/19.1.0/svm-19.1.0.jar
[ERROR] urls[5] = file:/Users/johndoe/.m2/repository/com/oracle/substratevm/svm-hosted-native-linux-amd64/19.1.0/svm-hosted-native-linux-amd64-19.1.0.tar.gz
[ERROR] urls[6] = file:/Users/johndoe/.m2/repository/com/oracle/substratevm/svm-hosted-native-darwin-amd64/19.1.0/svm-hosted-native-darwin-amd64-19.1.0.tar.gz
[ERROR] urls[7] = file:/Users/johndoe/.m2/repository/com/oracle/substratevm/svm-hosted-native-windows-amd64/19.1.0/svm-hosted-native-windows-amd64-19.1.0.tar.gz
[ERROR] urls[8] = file:/Users/johndoe/.m2/repository/com/oracle/substratevm/pointsto/19.1.0/pointsto-19.1.0.jar
[ERROR] urls[9] = file:/Users/johndoe/.m2/repository/org/graalvm/truffle/truffle-nfi/19.1.0/truffle-nfi-19.1.0.jar
[ERROR] urls[10] = file:/Users/johndoe/.m2/repository/org/graalvm/truffle/truffle-nfi-native-linux-amd64/19.1.0/truffle-nfi-native-linux-amd64-19.1.0.tar.gz
[ERROR] urls[11] = file:/Users/johndoe/.m2/repository/org/graalvm/truffle/truffle-nfi-native-linux-aarch64/19.1.0/truffle-nfi-native-linux-aarch64-19.1.0.tar.gz
[ERROR] urls[12] = file:/Users/johndoe/.m2/repository/org/graalvm/truffle/truffle-nfi-native-darwin-amd64/19.1.0/truffle-nfi-native-darwin-amd64-19.1.0.tar.gz
[ERROR] urls[13] = file:/Users/johndoe/.m2/repository/com/oracle/substratevm/objectfile/19.1.0/objectfile-19.1.0.jar
[ERROR] urls[14] = file:/Users/johndoe/.m2/repository/org/graalvm/compiler/compiler/19.1.0/compiler-19.1.0.jar
[ERROR] urls[15] = file:/Users/johndoe/.m2/repository/org/graalvm/truffle/truffle-api/19.1.0/truffle-api-19.1.0.jar
[ERROR] urls[16] = file:/Users/johndoe/.m2/repository/jline/jline/2.14.6/jline-2.14.6.jar
[ERROR] urls[17] = file:/Users/johndoe/.m2/repository/org/codehaus/plexus/plexus-archiver/3.3/plexus-archiver-3.3.jar
[ERROR] urls[18] = file:/Users/johndoe/.m2/repository/org/codehaus/plexus/plexus-utils/3.0.24/plexus-utils-3.0.24.jar
[ERROR] urls[19] = file:/Users/johndoe/.m2/repository/org/codehaus/plexus/plexus-io/2.7.1/plexus-io-2.7.1.jar
[ERROR] urls[20] = file:/Users/johndoe/.m2/repository/commons-io/commons-io/2.5/commons-io-2.5.jar
[ERROR] urls[21] = file:/Users/johndoe/.m2/repository/org/apache/commons/commons-compress/1.11/commons-compress-1.11.jar
[ERROR] urls[22] = file:/Users/johndoe/.m2/repository/org/iq80/snappy/snappy/0.4/snappy-0.4.jar
[ERROR] urls[23] = file:/Users/johndoe/.m2/repository/org/tukaani/xz/1.5/xz-1.5.jar
[ERROR] Number of foreign imports: 1
[ERROR] import: Entry[import from realm ClassRealm[maven.api, parent: null]]
[ERROR]
[ERROR] -----------------------------------------------------
[ERROR] : jdk.vm.ci.services.Services
答案 0 :(得分:1)
jdk.vm.ci.services.Services
应该来自用于构建本机映像的JDK。您需要确保JAVA_HOME
环境变量指向GraalVM。
您可以在this page上找到有关使用此插件的有用信息。