maven No plugin descriptor found at META-INF/maven/plugin.xml 在springboot

maven No plugin descriptor found at META-INF/maven/plugin.xml in springboot

我正在尝试使用 GraalVM native-image 来编译一个 spring-boot 项目来构建一个 .exe 文件。

我的 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>2.5.4</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>
    <groupId>com.qunhe.instdeco.diy</groupId>
    <artifactId>saas</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>saas</name>
    <description>Demo project for Spring Boot</description>
    <properties>
        <java.version>11</java.version>
    </properties>

    <pluginRepositories>
        <pluginRepository>
            <id>spring-milestone</id>
            <name>Spring milestone</name>
            <url>https://repo.spring.io/milestone</url>
        </pluginRepository>
    </pluginRepositories>

    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>org.apache.tomcat.embed</groupId>
                    <artifactId>tomcat-embed-websocket</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.springframework.experimental</groupId>
            <artifactId>spring-native</artifactId>
            <version>0.10.0-SNAPSHOT</version>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context-indexer</artifactId>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.graalvm.nativeimage</groupId>
                <artifactId>jvmti-agent-base</artifactId>
                <version>21.0.0.2</version>
                <configuration>
                    <buildArgs>-Dspring.graal.remove-unused-autoconfig=true --no-fallback -H:+ReportExceptionStackTraces --no-server</buildArgs>
                </configuration>
                <executions>
                    <execution>
                        <goals>
                            <goal>native-image</goal>
                        </goals>
                        <phase>package</phase>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

</project>

当我使用 mvn package 时,发生错误:

[INFO] --------------------------------[ jar ]---------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  0.259 s
[INFO] Finished at: 2021-08-24T15:25:31+08:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to parse plugin descriptor for org.graalvm.nativeimage:jvmti-agent-base:21.0.0.2 (C:\Users\yuanque\.m2\repository\org\graalvm\nativeimage\jvmti-agent-base.0.0.2\jvmti-agent-base-21.0.0.2.jar): No plugin descriptor found at META-INF/maven/plugin.xml -> [Help 1]
[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:

我试过修改我的maven的配置,试过使用不同的镜像下载插件,试过不同版本的插件,无论我怎么操作,它总是报错。

我的环境:

有人可以帮我吗?

没错,因为 org.graalvm.nativeimage:jvmti-agent-base 不是 Maven 插件。由于工件的描述 jvmti-agent-base 是

Base framework for creating a JVMTI agent.

试试这个:

<plugin>
    <groupId>org.graalvm.nativeimage</groupId>
    <artifactId>native-image-maven-plugin</artifactId> 
    <version>21.2.0</version>
    <configuration>
        <!-- ... -->
    </configuration>
</plugin>