package org.springframework.web.bind.annotation 不存在,即使它是在 POM 中定义的
2022-09-03 17:01:28
所以我有这个代码
import org.springframework.web.bind.annotation.GetMapping;
而且我已经在我的POM文件中有以下内容
<packaging>war</packaging>
<properties>
<spring.version>4.3.0.RELEASE</spring.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${spring.version}</version>
</dependency>
</dependencies>
然而,当我构建它时,它最终抱怨pack package org.springframework.web.bind.annotation不存在。
为什么?我已经添加了弹簧网作为依赖项。我做错了什么?