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

我的Maven POM文件出现两处错误,请求排查指导

Fixing Your Maven POM Dependency & Version Errors

Let's tackle your two errors one by one—they're both straightforward fixes once you spot the root issues:

1. Project version cannot be empty

Maven requires every project to define a version as part of its core GAV (GroupId, ArtifactId, Version) coordinates. Your POM is missing this mandatory element entirely.

Fix: Add a <version> tag right after your <packaging> element. For in-development projects, a common choice is 1.0-SNAPSHOT:

<groupId>practica</groupId>
<artifactId>app01</artifactId>
<name>app01</name>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version> <!-- Add this line -->

2. Missing dependency org.springframework:spring-context:jar:${org.springframework-Version}

This is a case-sensitive variable mismatch. In your <properties> section, you defined the Spring version with a lowercase v:

<org.springframework-version>3.1.1.RELEASE</org.springframework-version>

But in your spring-context dependency, you're referencing it with a capital V:

<version>${org.springframework-Version}</version>

Maven treats these as completely separate variables, so it can't resolve the version value you intended.

Fix: Update the version variable in your spring-context dependency to match the property name exactly:

<dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-context</artifactId>
    <version>${org.springframework-version}</version> <!-- Changed to lowercase v -->
    <exclusions>
        <!-- Exclude Commons Logging in favor of SLF4j -->
        <exclusion>
            <groupId>commons-logging</groupId>
            <artifactId>commons-logging</artifactId>
        </exclusion>
    </exclusions>
</dependency>

Bonus: Verify XML Closure

Looking at the end of your provided POM code, it seems the file might be truncated. Make sure all open tags (like <dependency>, <dependencies>, and <project>) are properly closed at the end of the file—invalid XML will also trigger Maven errors.

Once you apply these fixes, run mvn clean install again and your issues should be resolved!

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.29 07:48:23