How to set up different graalvm-home and java-home in CI server to build native image

Tags: , , ,



Issue: I want has two graalvm version in same CI server to build different quarkus version service project.

resason: Because a few old service use quarkus-1.5.1 & graalvm-20.0.0 and I can’t upgrade that version. but I want use quarkus-1.13.1 & graalvm-21.0.0 in new service.

tried: add quarkus.native.graalvm-home & quarkus.native.java-home in the pom.xml, setting graalvm path, but not working.

        <properties>
            <quarkus.package.type>native</quarkus.package.type>
            <quarkus.native.additional-build-args>${qaurkusNativeArgs}</quarkus.native.additional-build-args>
            <quarkus.native.graalvm-home>${quarkus.native.java-home}</quarkus.native.graalvm-home>
            <quarkus.native.java-home>${quarkus.native.java-home}</quarkus.native.java-home>
        </properties>

Answer

All you need to do is set the GRAALVM_HOME environment variable when you run mvn package -Dnative.

So something like GRAALVM_HOME=/some/path mvn package -Dnative will make Quarkus use GraalVM from /some/path.

See https://quarkus.io/guides/all-config#quarkus-core_quarkus.native.graalvm-home



Source: stackoverflow