You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

maven-war-plugin无法加载Mojo问题求助(Java 21环境)

构建GlassFish Jakarta9项目时Maven War插件API不兼容问题

环境信息

  • Java版本:21.0.4 2024-07-16 LTS
  • 目标项目:GlassFish Jakarta9相关示例模块

构建错误详情

Caused by: org.apache.maven.plugin.PluginExecutionException: Execution default-war of goal org.apache.maven.plugins:maven-war-plugin:3.0.0:war failed: Unable to load the mojo 'war' in the plugin 'org.apache.maven.plugins:maven-war-plugin:3.0.0' due to an API incompatibility: org.codehaus.plexus.component.repository.exception.ComponentLookupException: null

当前pom.xml的Build配置段

<build>
    <defaultGoal>install</defaultGoal>
    <pluginManagement>
        <plugins>
            <!-- Updated plugin versions -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.10.1</version> <!-- Use a more recent version -->
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-source-plugin</artifactId>
                <version>3.2.2</version> <!-- Use a more recent version -->
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-clean-plugin</artifactId>
                <version>3.2.0</version> <!-- Use a more recent version -->
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <version>3.10.0</version> <!-- Use a more recent version -->
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-war-plugin</artifactId>
                <version>3.5.0</version> <!-- Use a more recent version -->
            </plugin>
            <!-- Other plugins with updated versions -->
        </plugins>
    </pluginManagement>
    <plugins>
        <plugin>
            <groupId>org.codehaus.cargo</groupId>
            <artifactId>cargo-maven2-plugin</artifactId>
            <inherited>true</inherited>
            <configuration>
                <container>
                    <containerId>${integration.container.id}</containerId>
                    <type>installed</type>
                    <home>${glassfish.home}</home>
                </container>
                <configuration>
                    <type>standalone</type>
                    <home>${glassfish.home}/glassfish/domains</home>
                </configuration>
            </configuration>
        </plugin>
        <plugin>
            <artifactId>maven-release-plugin</artifactId>
            <version>3.0.0-M2</version> <!-- Update to a newer version -->
            <configuration>
                <mavenExecutorId>forked-path</mavenExecutorId>
                <useReleaseProfile>false</useReleaseProfile>
                <arguments>${release.arguments}</arguments>
                <autoVersionSubmodules>true</autoVersionSubmodules>
                <tagNameFormat>@{project.version}</tagNameFormat>
            </configuration>
            <dependencies>
                <dependency>
                    <groupId>org.apache.maven.scm</groupId>
                    <artifactId>maven-scm-provider-gitexe</artifactId>
                    <version>1.11.2</version>
                </dependency>
            </dependencies>
        </plugin>
    </plugins>
</build>

已尝试的操作

  • 将maven-compiler-plugin升级至3.10.1版本
  • 将maven-war-plugin升级至3.5.0版本

上述操作后问题依旧,求有效的解决建议。


内容的提问来源于stack exchange,提问作者user14386874

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.20 04:10:08