oracle / graal

GraalVM compiles Java applications into native executables that start instantly, scale fast, and use fewer compute resources 🚀
https://www.graalvm.org
Other
20.92k stars 1.71k forks source link

[GR-60767] Can not build with apt-maven-plugin in GraalVM23 or GraalVM24 #10391

Open DarkDance opened 5 months ago

DarkDance commented 5 months ago

Describe the issue When use maven build command with com.mysema.maven:apt-maven-plugin:1.1.3 for source generation, throws generated source not found exceotion, seems the source not gen.

Steps to reproduce the issue Please include both build steps as well as run steps

  1. git clone --depth 1 https://github.com/DarkDance/graakvm_spring_demo.git
  2. mvn -Pnative clean native:compile -f pom.xml

Describe GraalVM and your environment:

More details

  1. When use the newest [GraalVM CE 24.2.0-dev-20241213_1237] version and [sdk install java 23.0.1-graal] release version, all throw the error

    [INFO] Scanning for projects...
    [INFO]
    [INFO] -------------------------< com.demo:self-boot >-------------------------
    [INFO] Building self-boot 0.0.1-SNAPSHOT
    [INFO]   from pom.xml
    [INFO] --------------------------------[ jar ]---------------------------------
    [INFO]
    [INFO] --- clean:3.4.0:clean (default-clean) @ self-boot ---
    [INFO] Deleting /data/spring_native_test/demoserver/target
    [INFO]
    [INFO] >>> native:0.10.4:compile (default-cli) > package @ self-boot >>>
    [INFO]
    [INFO] --- apt:1.1.3:process (default) @ self-boot ---
    [INFO]
    [INFO] --- native:0.10.4:add-reachability-metadata (add-reachability-metadata) @ self-boot ---
    [INFO] Downloaded GraalVM reachability metadata repository from file:/mnt/d/Program_Files/apache/maven/repository/org/graalvm/buildtools/graalvm-reachability-metadata/0.10.4/graalvm-reachability-metadata-0.10.4-repository.zip
    [INFO] [graalvm reachability metadata repository for ch.qos.logback:logback-classic:1.5.12]: Configuration directory not found. Trying latest version.
    [INFO] [graalvm reachability metadata repository for ch.qos.logback:logback-classic:1.5.12]: Configuration directory is ch.qos.logback/logback-classic/1.4.9
    [INFO] [graalvm reachability metadata repository for com.fasterxml.jackson.core:jackson-databind:2.18.2]: Configuration directory not found. Trying latest version.
    [INFO] [graalvm reachability metadata repository for com.fasterxml.jackson.core:jackson-databind:2.18.2]: Configuration directory is com.fasterxml.jackson.core/jackson-databind/2.15.2
    [INFO] [graalvm reachability metadata repository for org.apache.tomcat.embed:tomcat-embed-core:10.1.34]: Configuration directory not found. Trying latest version.
    [INFO] [graalvm reachability metadata repository for org.apache.tomcat.embed:tomcat-embed-core:10.1.34]: Configuration directory is org.apache.tomcat.embed/tomcat-embed-core/10.0.20
    [INFO] [graalvm reachability metadata repository for com.zaxxer:HikariCP:5.1.0]: Configuration directory not found. Trying latest version.
    [INFO] [graalvm reachability metadata repository for com.zaxxer:HikariCP:5.1.0]: Configuration directory is com.zaxxer/HikariCP/5.0.1
    [INFO] [graalvm reachability metadata repository for org.hibernate.orm:hibernate-core:6.6.4.Final]: Configuration directory not found. Trying latest version.
    [INFO] [graalvm reachability metadata repository for org.hibernate.orm:hibernate-core:6.6.4.Final]: Configuration directory is org.hibernate.orm/hibernate-core/6.6.0.Final
    [INFO] [graalvm reachability metadata repository for org.jboss.logging:jboss-logging:3.6.1.Final]: Configuration directory not found. Trying latest version.
    [INFO] [graalvm reachability metadata repository for org.jboss.logging:jboss-logging:3.6.1.Final]: Configuration directory is org.jboss.logging/jboss-logging/3.5.0.Final
    [INFO] [graalvm reachability metadata repository for org.glassfish.jaxb:jaxb-runtime:4.0.5]: Configuration directory not found. Trying latest version.
    [INFO] [graalvm reachability metadata repository for org.glassfish.jaxb:jaxb-runtime:4.0.5]: Configuration directory is org.glassfish.jaxb/jaxb-runtime/3.0.2
    [INFO] [graalvm reachability metadata repository for com.h2database:h2:2.3.232]: Configuration directory not found. Trying latest version.
    [INFO] [graalvm reachability metadata repository for com.h2database:h2:2.3.232]: Configuration directory is com.h2database/h2/2.1.210
    [INFO]
    [INFO] --- resources:3.3.1:resources (default-resources) @ self-boot ---
    [INFO] Copying 1 resource from src/main/resources to target/classes
    [INFO] Copying 0 resource from src/main/resources to target/classes
    [INFO]
    [INFO] --- compiler:3.13.0:compile (default-compile) @ self-boot ---
    [INFO] Recompiling the module because of changed source code.
    [INFO] Compiling 7 source files with javac [debug parameters release 17] to target/classes
    [INFO] -------------------------------------------------------------
    [ERROR] COMPILATION ERROR :
    [INFO] -------------------------------------------------------------
    [ERROR] /data/spring_native_test/demoserver/src/main/java/com/demo/DemoQry.java:[9,26] cannot find symbol
    symbol:   class QDemo
    location: class com.demo.DemoQry
    [ERROR] /data/spring_native_test/demoserver/src/main/java/com/demo/DemoQry.java:[9,39] cannot find symbol
    symbol:   variable QDemo
    location: class com.demo.DemoQry
    [INFO] 2 errors
    [INFO] -------------------------------------------------------------
    [INFO] ------------------------------------------------------------------------
    [INFO] BUILD FAILURE
    [INFO] ------------------------------------------------------------------------
    [INFO] Total time:  8.647 s
    [INFO] Finished at: 2024-12-30T22:18:31+08:00
    [INFO] ------------------------------------------------------------------------
    [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.13.0:compile (default-compile) on project self-boot: Compilation failure: Compilation failure:
    [ERROR] /data/spring_native_test/demoserver/src/main/java/com/demo/DemoQry.java:[9,26] cannot find symbol
    [ERROR]   symbol:   class QDemo
    [ERROR]   location: class com.demo.DemoQry
    [ERROR] /data/spring_native_test/demoserver/src/main/java/com/demo/DemoQry.java:[9,39] cannot find symbol
    [ERROR]   symbol:   variable QDemo
    [ERROR]   location: class com.demo.DemoQry
    [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/MojoFailureException
  2. But use the old version is ok, such as [sdk install java 21.0.5-graal] release version or a [GraalVM CE 23-dev+12.1]old dev version:

    • openjdk version "23" 2024-09-17 OpenJDK Runtime Environment GraalVM CE 23-dev+12.1 (build 23+12-jvmci-b01) OpenJDK 64-Bit Server VM GraalVM CE 23-dev+12.1 (build 23+12-jvmci-b01, mixed mode, sharing)
      [INFO] Scanning for projects...
      [INFO]
      [INFO] -------------------------< com.demo:self-boot >-------------------------
      [INFO] Building self-boot 0.0.1-SNAPSHOT
      [INFO]   from pom.xml
      [INFO] --------------------------------[ jar ]---------------------------------
      [INFO]
      [INFO] --- clean:3.4.0:clean (default-clean) @ self-boot ---
      [INFO] Deleting /data/spring_native_test/demoserver/target
      [INFO]
      [INFO] >>> native:0.10.4:compile (default-cli) > package @ self-boot >>>
      [INFO]
      [INFO] --- apt:1.1.3:process (default) @ self-boot ---
      [INFO]
      [INFO] --- native:0.10.4:add-reachability-metadata (add-reachability-metadata) @ self-boot ---
      [INFO] Downloaded GraalVM reachability metadata repository from file:/mnt/d/Program_Files/apache/maven/repository/org/graalvm/buildtools/graalvm-reachability-metadata/0.10.4/graalvm-reachability-metadata-0.10.4-repository.zip
      [INFO] [graalvm reachability metadata repository for ch.qos.logback:logback-classic:1.5.12]: Configuration directory not found. Trying latest version.
      [INFO] [graalvm reachability metadata repository for ch.qos.logback:logback-classic:1.5.12]: Configuration directory is ch.qos.logback/logback-classic/1.4.9
      [INFO] [graalvm reachability metadata repository for com.fasterxml.jackson.core:jackson-databind:2.18.2]: Configuration directory not found. Trying latest version.
      [INFO] [graalvm reachability metadata repository for com.fasterxml.jackson.core:jackson-databind:2.18.2]: Configuration directory is com.fasterxml.jackson.core/jackson-databind/2.15.2
      [INFO] [graalvm reachability metadata repository for org.apache.tomcat.embed:tomcat-embed-core:10.1.34]: Configuration directory not found. Trying latest version.
      [INFO] [graalvm reachability metadata repository for org.apache.tomcat.embed:tomcat-embed-core:10.1.34]: Configuration directory is org.apache.tomcat.embed/tomcat-embed-core/10.0.20
      [INFO] [graalvm reachability metadata repository for com.zaxxer:HikariCP:5.1.0]: Configuration directory not found. Trying latest version.
      [INFO] [graalvm reachability metadata repository for com.zaxxer:HikariCP:5.1.0]: Configuration directory is com.zaxxer/HikariCP/5.0.1
      [INFO] [graalvm reachability metadata repository for org.hibernate.orm:hibernate-core:6.6.4.Final]: Configuration directory not found. Trying latest version.
      [INFO] [graalvm reachability metadata repository for org.hibernate.orm:hibernate-core:6.6.4.Final]: Configuration directory is org.hibernate.orm/hibernate-core/6.6.0.Final
      [INFO] [graalvm reachability metadata repository for org.jboss.logging:jboss-logging:3.6.1.Final]: Configuration directory not found. Trying latest version.
      [INFO] [graalvm reachability metadata repository for org.jboss.logging:jboss-logging:3.6.1.Final]: Configuration directory is org.jboss.logging/jboss-logging/3.5.0.Final
      [INFO] [graalvm reachability metadata repository for org.glassfish.jaxb:jaxb-runtime:4.0.5]: Configuration directory not found. Trying latest version.
      [INFO] [graalvm reachability metadata repository for org.glassfish.jaxb:jaxb-runtime:4.0.5]: Configuration directory is org.glassfish.jaxb/jaxb-runtime/3.0.2
      [INFO] [graalvm reachability metadata repository for com.h2database:h2:2.3.232]: Configuration directory not found. Trying latest version.
      [INFO] [graalvm reachability metadata repository for com.h2database:h2:2.3.232]: Configuration directory is com.h2database/h2/2.1.210
      [INFO]
      [INFO] --- resources:3.3.1:resources (default-resources) @ self-boot ---
      [INFO] Copying 1 resource from src/main/resources to target/classes
      [INFO] Copying 0 resource from src/main/resources to target/classes
      [INFO]
      [INFO] --- compiler:3.13.0:compile (default-compile) @ self-boot ---
      [INFO] Recompiling the module because of changed source code.
      [INFO] Compiling 7 source files with javac [debug parameters release 17] to target/classes
      [INFO] Annotation processing is enabled because one or more processors were found
      on the class path. A future release of javac may disable annotation processing
      unless at least one processor is specified by name (-processor), or a search
      path is specified (--processor-path, --processor-module-path), or annotation
      processing is enabled explicitly (-proc:only, -proc:full).
      Use -Xlint:-options to suppress this message.
      Use -proc:none to disable annotation processing.
      [INFO]
      [INFO] --- resources:3.3.1:testResources (default-testResources) @ self-boot ---
      [INFO] skip non existing resourceDirectory /data/spring_native_test/demoserver/src/test/resources
      [INFO]
      [INFO] --- compiler:3.13.0:testCompile (default-testCompile) @ self-boot ---
      [INFO] No sources to compile
      .......
      /data/spring_native_test/demoserver/target/libjvm.so (jdk_library_shim)
      /data/spring_native_test/demoserver/target/liblcms.so (jdk_library)
      /data/spring_native_test/demoserver/target/self-boot (executable)
      ========================================================================================================================
      Finished generating 'self-boot' in 1m 29s.
      [INFO] ------------------------------------------------------------------------
      [INFO] BUILD SUCCESS
      [INFO] ------------------------------------------------------------------------
      [INFO] Total time:  01:51 min
      [INFO] Finished at: 2024-12-30T22:24:36+08:00
      [INFO] ------------------------------------------------------------------------
selhagani commented 5 months ago

Hi @DarkDance,

Thank you for reaching out to us about this. We will take a closer look into this and I'll make sure to keep you updated.