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

Spring Starter Project项目pom.xml报MavenArchiver.getManifest异常求助

解决Spring Starter Project中MavenArchiver.getManifest异常的方案

我之前用Spring Starter创建项目时也碰到过一模一样的问题,这个异常基本是Maven Archiver组件版本不兼容或者依赖冲突导致的,给你几个亲测有效的解决思路:

  • 指定明确的Maven Archiver版本
    有时候Spring Boot Starter默认引入的Maven Archiver版本和本地Maven环境、其他依赖存在版本冲突,直接在pom.xml中声明兼容的版本即可:

    <dependencies>
        <!-- 其他依赖 -->
        <dependency>
            <groupId>org.apache.maven</groupId>
            <artifactId>maven-archiver</artifactId>
            <version>3.5.2</version> <!-- 建议选和你的Spring Boot版本匹配的,比如Spring Boot 2.x系列适配3.x版本 -->
        </dependency>
    </dependencies>
    
  • 清理Maven本地缓存
    本地Maven仓库的依赖文件损坏也可能触发这个异常,执行以下命令强制清理并重新构建:

    mvn clean install -U
    

    -U参数会强制更新所有快照依赖,同时修复本地仓库中可能损坏的文件。

  • 对齐Spring Boot Maven插件版本
    如果项目中使用了spring-boot-maven-plugin,一定要确保它的版本和Spring Boot核心版本完全一致,避免版本不匹配带来的问题:

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <version>${spring-boot.version}</version> <!-- 这里的变量要和parent中的spring-boot版本保持一致 -->
            </plugin>
        </plugins>
    </build>
    
  • 排查并排除冲突依赖
    用Maven的依赖树命令找出重复引入的Maven Archiver依赖:

    mvn dependency:tree | grep maven-archiver
    

    找到冲突的依赖来源后,在对应的依赖中排除旧版本的Maven Archiver:

    <dependency>
        <groupId>冲突依赖的groupId</groupId>
        <artifactId>冲突依赖的artifactId</artifactId>
        <exclusions>
            <exclusion>
                <groupId>org.apache.maven</groupId>
                <artifactId>maven-archiver</artifactId>
            </exclusion>
        </exclusions>
    </dependency>
    

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.27 06:57:21