native-build-tools icon indicating copy to clipboard operation
native-build-tools copied to clipboard

Test binary fails to build

Open gfmedeiros opened this issue 2 years ago • 0 comments

Describe the bug The Maven plugin fails when when trying to build a native test binary. Building the actual binary works as expected.

To Reproduce Use this reproducer.

Expected behavior The test binary should be built successfully.

Logs

➜  graalvm-native-build-tools-bug git:(main) ./mvnw -Pnative test                                  
[INFO] Scanning for projects...
[INFO] 
[INFO] ------------------------< com.example:example >-------------------------
[INFO] Building example 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] 
[INFO] --- maven-resources-plugin:3.2.0:resources (default-resources) @ example ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Using 'UTF-8' encoding to copy filtered properties files.
[INFO] skip non existing resourceDirectory /home/gabriel/graalvm-native-build-tools-bug/src/main/resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ example ---
[INFO] Nothing to compile - all classes are up to date
[INFO] 
[INFO] --- maven-resources-plugin:3.2.0:testResources (default-testResources) @ example ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Using 'UTF-8' encoding to copy filtered properties files.
[INFO] skip non existing resourceDirectory /home/gabriel/graalvm-native-build-tools-bug/src/test/resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ example ---
[INFO] Nothing to compile - all classes are up to date
[INFO] 
[INFO] --- maven-surefire-plugin:3.0.0-M7:test (default-test) @ example ---
[INFO] Using auto detected provider org.apache.maven.surefire.junitplatform.JUnitPlatformProvider
[INFO] 
[INFO] -------------------------------------------------------
[INFO]  T E S T S
[INFO] -------------------------------------------------------
[INFO] Running com.example.ExampleTest
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.046 s - in com.example.ExampleTest
[INFO] 
[INFO] Results:
[INFO] 
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
[INFO] 
[INFO] 
[INFO] --- native-maven-plugin:0.9.13:test (test-native) @ example ---
[INFO] ====================
[INFO] Initializing project: example
[INFO] ====================
[INFO] Found GraalVM installation from GRAALVM_HOME variable.
[INFO] ImageClasspath Entry: com.example:example:jar:1.0-SNAPSHOT (file:///home/gabriel/graalvm-native-build-tools-bug/target/classes/)
[WARNING] Artifact `/home/gabriel/graalvm-native-build-tools-bug/target/classes` is a directory.
[INFO] ImageClasspath Entry: org.junit.jupiter:junit-jupiter-api:jar:5.9.0:test (file:///home/gabriel/.m2/repository/org/junit/jupiter/junit-jupiter-api/5.9.0/junit-jupiter-api-5.9.0.jar)
[INFO] ImageClasspath Entry: org.junit.platform:junit-platform-engine:jar:1.9.0:test (file:///home/gabriel/.m2/repository/org/junit/platform/junit-platform-engine/1.9.0/junit-platform-engine-1.9.0.jar)
[INFO] ImageClasspath Entry: org.opentest4j:opentest4j:jar:1.2.0:test (file:///home/gabriel/.m2/repository/org/opentest4j/opentest4j/1.2.0/opentest4j-1.2.0.jar)
[INFO] ImageClasspath Entry: org.junit.platform:junit-platform-commons:jar:1.9.0:test (file:///home/gabriel/.m2/repository/org/junit/platform/junit-platform-commons/1.9.0/junit-platform-commons-1.9.0.jar)
[INFO] ImageClasspath Entry: org.apiguardian:apiguardian-api:jar:1.1.2:test (file:///home/gabriel/.m2/repository/org/apiguardian/apiguardian-api/1.1.2/apiguardian-api-1.1.2.jar)
[INFO] ImageClasspath Entry: org.junit.jupiter:junit-jupiter-engine:jar:5.9.0:test (file:///home/gabriel/.m2/repository/org/junit/jupiter/junit-jupiter-engine/5.9.0/junit-jupiter-engine-5.9.0.jar)
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  1.947 s
[INFO] Finished at: 2022-08-15T20:12:51-03:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.graalvm.buildtools:native-maven-plugin:0.9.13:test (test-native) on project example: Execution test-native of goal org.graalvm.buildtools:native-maven-plugin:0.9.13:test failed: A required class was missing while executing org.graalvm.buildtools:native-maven-plugin:0.9.13:test: org/graalvm/nativeimage/hosted/Feature
[ERROR] -----------------------------------------------------
[ERROR] realm =    extension>org.graalvm.buildtools:native-maven-plugin:0.9.13
[ERROR] strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
[ERROR] urls[0] = file:/home/gabriel/.m2/repository/org/graalvm/buildtools/native-maven-plugin/0.9.13/native-maven-plugin-0.9.13.jar
[ERROR] urls[1] = file:/home/gabriel/.m2/repository/org/graalvm/buildtools/junit-platform-native/0.9.13/junit-platform-native-0.9.13.jar
[ERROR] urls[2] = file:/home/gabriel/.m2/repository/org/junit/platform/junit-platform-console/1.8.1/junit-platform-console-1.8.1.jar
[ERROR] urls[3] = file:/home/gabriel/.m2/repository/org/junit/platform/junit-platform-reporting/1.8.1/junit-platform-reporting-1.8.1.jar
[ERROR] urls[4] = file:/home/gabriel/.m2/repository/org/apiguardian/apiguardian-api/1.1.2/apiguardian-api-1.1.2.jar
[ERROR] urls[5] = file:/home/gabriel/.m2/repository/org/junit/platform/junit-platform-launcher/1.8.1/junit-platform-launcher-1.8.1.jar
[ERROR] urls[6] = file:/home/gabriel/.m2/repository/org/junit/platform/junit-platform-engine/1.8.1/junit-platform-engine-1.8.1.jar
[ERROR] urls[7] = file:/home/gabriel/.m2/repository/org/opentest4j/opentest4j/1.2.0/opentest4j-1.2.0.jar
[ERROR] urls[8] = file:/home/gabriel/.m2/repository/org/junit/platform/junit-platform-commons/1.8.1/junit-platform-commons-1.8.1.jar
[ERROR] urls[9] = file:/home/gabriel/.m2/repository/org/junit/jupiter/junit-jupiter/5.8.1/junit-jupiter-5.8.1.jar
[ERROR] urls[10] = file:/home/gabriel/.m2/repository/org/junit/jupiter/junit-jupiter-api/5.8.1/junit-jupiter-api-5.8.1.jar
[ERROR] urls[11] = file:/home/gabriel/.m2/repository/org/junit/jupiter/junit-jupiter-params/5.8.1/junit-jupiter-params-5.8.1.jar
[ERROR] urls[12] = file:/home/gabriel/.m2/repository/org/junit/jupiter/junit-jupiter-engine/5.8.1/junit-jupiter-engine-5.8.1.jar
[ERROR] urls[13] = file:/home/gabriel/.m2/repository/org/graalvm/buildtools/utils/0.9.13/utils-0.9.13.jar
[ERROR] urls[14] = file:/home/gabriel/.m2/repository/com/fasterxml/jackson/core/jackson-databind/2.13.3/jackson-databind-2.13.3.jar
[ERROR] urls[15] = file:/home/gabriel/.m2/repository/com/fasterxml/jackson/core/jackson-annotations/2.13.3/jackson-annotations-2.13.3.jar
[ERROR] urls[16] = file:/home/gabriel/.m2/repository/com/fasterxml/jackson/core/jackson-core/2.13.3/jackson-core-2.13.3.jar
[ERROR] urls[17] = file:/home/gabriel/.m2/repository/org/graalvm/buildtools/graalvm-reachability-metadata/0.9.13/graalvm-reachability-metadata-0.9.13.jar
[ERROR] urls[18] = file:/home/gabriel/.m2/repository/org/codehaus/plexus/plexus-utils/1.1/plexus-utils-1.1.jar
[ERROR] Number of foreign imports: 1
[ERROR] import: Entry[import  from realm ClassRealm[maven.api, parent: null]]
[ERROR] 
[ERROR] -----------------------------------------------------
[ERROR] : org.graalvm.nativeimage.hosted.Feature
[ERROR] -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginContainerException

System Info (please complete the following information):

  • OS: Linux Mint 20.3
  • GraalVM Version 22.1.0.0.r17-mandrel
  • Java Version 17
  • Plugin version native-gradle-plugin:0.9.13

gfmedeiros avatar Aug 15 '22 23:08 gfmedeiros