My project has two modules
Add native-maven-plugin plug-ins to the web module
Error occurs when executing the packing command
ERROR:
mvn native:compile -Pnative
[INFO] Scanning for projects...
[ERROR] [ERROR] Some problems were encountered while processing the POMs:
[FATAL] Non-resolvable parent POM for com.ycky:ycky_posts:1.0.0-SNAPSHOT: Could not find artifact com.ycky:ycky_bcl_starter_parent:pom:2.0.0-SNAPSHOT and 'parent.relativePath' points at no local POM @ line 6, column 13
@
[ERROR] The build could not read 1 project -> [Help 1]
[ERROR]
[ERROR] The project com.ycky:ycky_posts:1.0.0-SNAPSHOT (/Users/hanfz/Dev/Code/ycky/ycky_posts/pom.xml) has 1 error
[ERROR] Non-resolvable parent POM for com.ycky:ycky_posts:1.0.0-SNAPSHOT: Could not find artifact com.ycky:ycky_bcl_starter_parent:pom:2.0.0-SNAPSHOT and 'parent.relativePath' points at no local POM @ line 6, column 13 -> [Help 2]
[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/ProjectBuildingException
[ERROR] [Help 2] http://cwiki.apache.org/confluence/display/MAVEN/UnresolvableModelException
If you do not package it as a native-image but as a jar package, no error will be reported
Comment From: matthenry87
Here's an example of how to setup a multi-module project to build a native image: https://github.com/matthenry87/native-image-multimodule-testing
I am about to submit a bug I found related to multiple data sources and came across your issue. The main POM has:
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
<plugin>
<groupId>org.graalvm.buildtools</groupId>
<artifactId>native-maven-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
</plugins>
</build>
The dependency module has(also has my persistence code in it):
<build>
<plugins>
<plugin>
<groupId>org.hibernate.orm.tooling</groupId>
<artifactId>hibernate-enhance-maven-plugin</artifactId>
<version>${hibernate.version}</version>
<executions>
<execution>
<id>enhance</id>
<goals>
<goal>enhance</goal>
</goals>
<configuration>
<enableLazyInitialization>true</enableLazyInitialization>
<enableDirtyTracking>true</enableDirtyTracking>
<enableAssociationManagement>true</enableAssociationManagement>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
</plugins>
</build>
And the runnable module:
<build>
<plugins>
<plugin>
<groupId>org.graalvm.buildtools</groupId>
<artifactId>native-maven-plugin</artifactId>
<configuration>
<skip>false</skip>
</configuration>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<skip>false</skip>
</configuration>
</plugin>
</plugins>
</build>
Then I am able to run this just fine: mvn -U clean install && mvn native:compile -Pnative -DskipTests
Comment From: linuyx
以下是如何设置多模块项目以构建原生图像的示例:https ://github.com/matthenry87/native-image-multimodule-testing
我正要提交一个我发现与多个数据源相关的错误并遇到了您的问题。主 POM 有:
<build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> <configuration> <skip>true</skip> </configuration> </plugin> <plugin> <groupId>org.graalvm.buildtools</groupId> <artifactId>native-maven-plugin</artifactId> <configuration> <skip>true</skip> </configuration> </plugin> </plugins> </build>依赖模块有(也有我的持久性代码):
<build> <plugins> <plugin> <groupId>org.hibernate.orm.tooling</groupId> <artifactId>hibernate-enhance-maven-plugin</artifactId> <version>${hibernate.version}</version> <executions> <execution> <id>enhance</id> <goals> <goal>enhance</goal> </goals> <configuration> <enableLazyInitialization>true</enableLazyInitialization> <enableDirtyTracking>true</enableDirtyTracking> <enableAssociationManagement>true</enableAssociationManagement> </configuration> </execution> </executions> </plugin> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> <configuration> <skip>true</skip> </configuration> </plugin> </plugins> </build>和可运行模块:
<build> <plugins> <plugin> <groupId>org.graalvm.buildtools</groupId> <artifactId>native-maven-plugin</artifactId> <configuration> <skip>false</skip> </configuration> </plugin> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> <configuration> <skip>false</skip> </configuration> </plugin> </plugins> </build>然后我就可以正常运行了:
mvn -U clean install && mvn native:compile -Pnative -DskipTests
I have added the plug-ins provided by you to the main module and each module, but the dependency will have the same error, and the problem has not been solved
I don't know whether it is related to the fact that I added my own parent. Because I successfully created a new multi module project and used spring-boot-start-parent
Comment From: matthenry87
@linuyx Yeah is probably related to you not using the Spring Boot Starter Parent. It provides a lot of plugin configuration for you (plus the dependency BOM). I recommend always using it. Let Spring Boot manage that stuff for you, that's part of it's benefits.
However.. your error suggests that it simply can't find that project's parent POM.. unrelated to native image. Maybe try installing that parent POM into your local Maven repo by running mvn install on it?
Comment From: linuyx
@linuyx Yeah is probably related to you not using the Spring Boot Starter Parent. It provides a lot of plugin configuration for you (plus the dependency BOM). I recommend always using it. Let Spring Boot manage that stuff for you, that's part of it's benefits.
However.. your error suggests that it simply can't find that project's parent POM.. unrelated to native image. Maybe try installing that parent POM into your local Maven repo by running mvn install on it?
Thanks for your help. I'll study it again
Comment From: wilkinsona
Thanks for helping out here, @matthenry87.