gpt4 book ai didi

java - 导入 org.springframework 无法解决

转载 作者:行者123 更新时间:2023-12-02 08:52:25 24 4
gpt4 key购买 nike

这是我的 pom.xml 文件。我正在使用 eclipse。我正在尝试制作一个 helloworld spring 应用程序。T https://www.tutorialspoint.com/spring/spring_hello_world_example.htm

<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>
<groupId>spring-boot-gradle</groupId>
<artifactId>spring-boot-gradle</artifactId>
<version>0.0.1-SNAPSHOT</version>
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<configuration>
<release>13</release>
</configuration>
</plugin>
</plugins>
</build>
</project>

最佳答案

您需要在 pom.xml 中声明对 Maven 项目的依赖关系。更新您的 Maven 项目后(右键单击项目并在 Maven 选项内更新项目)。这些 jar 将由您的项目管理,之后只有您才能导入 spring 特定的类。您可以在 pom.xml 中声明依赖项,如下所示:

<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>5.2.4.RELEASE</version>
</dependency>
</dependencies>

如果您不清楚 Maven 基础知识,可以在任何初学者教程中阅读有关 Maven 依赖项的更多信息。

关于java - 导入 org.springframework 无法解决,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60693449/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com