custom runtime issue with native-maven-plugin having metadataRepository enabled

417 Views Asked by At

I have an app built with Spring Boot 3.0.0-M5, Spring Cloud 2022.0.0-M4, Java 17. Its GitHub repo is https://github.com/wenqiglantz/springboot3-webclient/tree/metadata. I am trying to achieve the following:

  1. Enable metadataRepository configuration in native-maven-plugin in my app to assist in my native image build as this plugin automatically searches for GraalVM reachability metadata repo.
  2. Need to create a custom runtime (in a zip format) using maven-assembly-plugin as I need to deploy my app to AWS Lambda since Lambda doesn't yet support Java 17 runtime.

I was able to generate the custom runtime in a zip file with maven-assembly-plugin and a few config files in my source code and deploy to Lambda (my github actions workflow run https://github.com/wenqiglantz/springboot3-webclient/actions/runs/3146602388/jobs/5115233455). However, after adding native-maven-plugin to enable metadataRepository, my custom runtime build broke, it no longer generates the zip file (github actions workflow run https://github.com/wenqiglantz/springboot3-webclient/actions/runs/3151692666/jobs/5125968700). Also see attached the comparison screenshot. The maven command I use in my workflow is mvn -ntp clean package -Pnative -e -X. In my root pom. Unfortunately I have not been able to find any good documentation on either GraalVM side or Spring Boot side on how to configure such plugins to achieve what I want. I have the plugins configured as the following, let me know what's the best way to handle configuring both maven-assembly-plugin and native-maven-plugin so I can accomplish my two goals listed above.

<build>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
        </plugin>
        <plugin>
            <artifactId>maven-assembly-plugin</artifactId>
            <executions>
                <execution>
                    <id>native-zip</id>
                    <phase>package</phase>
                    <goals>
                        <goal>single</goal>
                    </goals>
                    <inherited>false</inherited>
                </execution>
            </executions>
            <configuration>
                <descriptors>
                    <descriptor>src/assembly/native.xml</descriptor>
                </descriptors>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.graalvm.buildtools</groupId>
            <artifactId>native-maven-plugin</artifactId>
            <version>0.9.14</version>
            <extensions>true</extensions>
            <executions>
                <execution>
                    <id>build-native</id>
                    <goals>
                        <goal>compile-no-fork</goal>
                    </goals>
                    <phase>package</phase>
                </execution>
            </executions>
            <configuration>
                <metadataRepository>
                    <enabled>true</enabled>
                </metadataRepository>
            </configuration>
        </plugin>
    </plugins>
</build>

enter image description here

0

There are 0 best solutions below