Spring Native - load Spring from dependency

40 views Asked by At

the idea is to have library containing Spring Boot, configuation (e.g. a change the banner.txt) and a boilerplate code which is reused in future projects. Using this library in other projects works like a charm and really cleans up the pom and code. Lately we came along Spring Native and gave it a try.

It turned out that Spring native doens't like it when the project pom doesn't contain the spring libs. Somehow it adds it's own Spring Boot, and ignores the Spring in the lib. As a result the default spring banner is printed when i start the native app. Also it immediately stops after printing the default banner instead of the customized banner.

PS D:\projects\native> .\target\native.exe
  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::                (v3.1.5)
PS D:\projects\native>

When Spring is included in the projects pom.xml, not in a seperate lib, i works like a charm. Any suggestions on how to solve my issue?

Guess it's somewhere here located:

   <profiles>
        <profile>
            <id>native</id>
            <build>
                <pluginManagement>
                    <plugins>
                        <plugin>
                            <groupId>org.graalvm.buildtools</groupId>
                            <artifactId>native-maven-plugin</artifactId>
                            <version>0.9.27</version>
                            <extensions>true</extensions>
                            <executions>
                                <execution>
                                    <id>build-image</id>
                                    <goals>
                                        <goal>compile-no-fork</goal>
                                    </goals>
                                </execution>
                            </executions>
                            <configuration>
                                <fallback>false</fallback>
                                <buildArgs>
                                    <arg>-H:DashboardDump=${imageName} -H:+DashboardAll -H:-CheckToolchain
                                        -H:+UnlockExperimentalVMOptions -H:+RemoveUnusedSymbols -H:+StrictImageHeap
                                        -march=native -H:+BuildReport
                                    </arg>
                                </buildArgs>
                            </configuration>
                        </plugin>
                    </plugins>
                </pluginManagement>
            </build>
        </profile>
    </profiles>

Thanks in advance

0

There are 0 answers