26 April 2020

I have been having trouble in the past to build native images for Quarkus applications under Windows due to a chain of issues.

With Quarkus 1.3.2.Final, I can finally confirm that I am sucessfully able to build. See below for the steps and exact environment used.

Steps

As I don’t have a Windows system, I downloaded the VirtualBox image of Windows 10 from Microsoft.

Within the VM, I installed GraalVM 2.0.0 for Java 11. See here for the latest releases.

I extracted GraalVM and from within the bin folder I ran gu install native-image to install the native-image tool. I also set up PATH, GRAALVM_HOME and JAVA_HOME to point to the GraalVM folder. Well, PATH obviously to the bin folder.

Now, I installed Visual Studio 2019 as it is required for the native compilation. (the description on the GraalVM page is only very high-level)

Just because it is easier to describe and provide commands, I first installed Chocolatey which is a package manager for Windows.

After this, you should be able to install Visual Studio from your Powershell (as Admin) like this:

choco install visualstudio2019-workload-vctools

After this, you should find this file on your filesystem:

C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Auxiliary\Build\vcvars64.bat

Finally, run your native-image build from a Command-prompt. Note that you have to call the vcvars64.bat to have the proper build environment:

call "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Auxiliary\Build\vcvars64.bat"
mvnw package -Pnative -DskipTests