No plugin found for prefix 'native-image' in the current project and in the plugin groups [org.apache.maven.plugins, org.codehaus.mojo] available from the repositories
romil-patel-integrella opened this issue · 4 comments
I have a Spring Boot project with v3.1.0 and Java 17 which works fine. I am adding the GraalVM and trying to create the native containerized image. To create the same I am running the below command which results in No plugin found for prefix 'native-image' in the current project and in the plugin groups [org.apache.maven.plugins, org.codehaus.mojo] available from the repositories
Command:
mvn native-image:native-image -Dimage=$REPO:$TAG -Djib.container.environment=SPRING_PROFILES_ACTIVE=prod
pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>3.1.0</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.xyz</groupId>
<artifactId>abc</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>app</name>
<description>app</description>
<properties>
<java.version>17</java.version>
<apache.poi.ooxml.version>4.1.2</apache.poi.ooxml.version>
<checkstyle-plugin.version>3.2.0</checkstyle-plugin.version>
<checkstyle.version>10.5.0</checkstyle.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>${apache.poi.ooxml.version}</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>ooxml-schemas</artifactId>
<version>1.4</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
<version>2.0.2</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.graalvm.buildtools</groupId>
<artifactId>native-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<excludes>
<exclude>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</exclude>
</excludes>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>${checkstyle-plugin.version}</version>
<dependencies>
<dependency>
<groupId>com.puppycrawl.tools</groupId>
<artifactId>checkstyle</artifactId>
<version>${checkstyle.version}</version>
</dependency>
</dependencies>
<executions>
<execution>
<id>checkstyle</id>
<phase>validate</phase>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
<configuration>
<configLocation>checkstyle.xml</configLocation>
<excludes>**/module-info.java,**/target/**/*,**/protocols/**/*</excludes>
<consoleOutput>true</consoleOutput>
<failsOnError>true</failsOnError>
<violationSeverity>warning</violationSeverity>
<failOnViolation>true</failOnViolation>
<linkXRef>false</linkXRef>
</configuration>
</plugin>
<plugin>
<groupId>com.google.cloud.tools</groupId>
<artifactId>jib-maven-plugin</artifactId>
<version>3.3.2</version>
<dependencies>
<dependency>
<groupId>com.google.cloud.tools</groupId>
<artifactId>jib-native-image-extension-maven</artifactId>
<version>0.1.0</version>
</dependency>
</dependencies>
<configuration>
<pluginExtensions>
<pluginExtension>
<implementation>com.google.cloud.tools.jib.maven.extension.nativeimage.JibNativeImageExtension</implementation>
</pluginExtension>
</pluginExtensions>
</configuration>
</plugin>
</plugins>
</build>
</project>
Hi @romil-patel-integrella - I see that the pom snippet above uses org.graalvm.buildtools.native-maven-plugin
, and think the documentation/error messages in this Jib extension may be a bit dated here and have caused confusion.
This extension was initially written to work with an older version of this plugin (old coordinates: org.graalvm.nativeimage.native-image-maven-plugin
) that had the native-image:native-image
goal, but reading the documentation for the new native-image-plugin, I see that the goal names and commands for building the native-image executable have changed. Looks like with the newer plugin, this is now done through mvn -Pnative -DskipTests package
or mvn native:compile
.
Could you try building the native-image executable with these commands and see if this is working first, before adding the Jib goal (... jib:build -Dimage=$REPO:$TAG …
) to containerize? Hopefully this can help narrow down the issue as well. Thanks!
Hi @emmileaf, Thanks for sharing the details
I am successfully able to run the below commands. However, If I do run the mvn clean -Pnative -DskipTests package
It does not invoke the GraalVM steps that I can see with the mvn -Pnative native:compile
mvn clean -Pnative -DskipTests package
mvn -Pnative native:compile
Also I am able to build the image using if I remove the dependencies and configurations from the jib plugin. Does below command create the native containerized image?
mvn -Pnative native:compile jib:build -Dimage=$REPO:$TAG -Djib.container.environment=SPRING_PROFILES_ACTIVE=prod
However, if I add the native as -Djib.container.environment=SPRING_PROFILES_ACTIVE=prod,native fails
However, if I add the native as -Djib.container.environment=SPRING_PROFILES_ACTIVE=prod,native fails
@romil-patel-integrella Could you help share the error message you are now seeing with mvn -Pnative native:compile
and the Jib parameters? (Assuming it's different that the original one reported in the issue)
Closing issue due to lack of OP response. Please reopen if this is still an issue.