我正在努力将spring框架
库添加到我的eclipse中(使用maven插件m2eclipse
)
我怎样才能以最简单的方式实现它?为什么对于新手用户来说如此复杂?
我无法继续处理这么简单的事情,这真的很令人沮丧。
主要目标是将 spring 库添加到我的 pom.xml
文件中,该文件位于 Eclipse 中的动态 Web 项目
的 depedcies
选项卡中。 Pom.xml
是通过 maven 插件
生成的。
首先,我移至 Eclipse Marketplace
并安装了 Spring Tool Suite for Eclipse Kepler 4.3
,结果什么也没有 - 仍然无法添加库。第二次尝试是为我的整个 Windows 安装相同的套件,到目前为止没有任何效果。
示例屏幕截图(我能添加的就是这个):
spring-web、spring-context、spring-webmvc 等在哪里?对我来说,现在是夜晚,我没有新的眼光,但我在这里错过了什么?
最佳答案
我已经在 Eclipse 中使用 Spring 框架和 Java 一段时间了。说实话,pom.xml 的 UI 完全糟糕。只需避免使用 Maven 的 Eclipse UI 并操作原始 XML。它非常直观且功能强大。
因此,如果您想添加依赖项,请开始使用 mvnrepository 。从那里您可以获得所需的所有依赖项片段。
对于“spring-web”插入
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>3.2.4.RELEASE</version>
</dependency>
在 <dependencies></dependencies>
部分。你已经准备好了。
对于 context 和 webmvc 也可以做同样的事情。
为了方便起见,这里使用 spring-webmvc:
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>4.0.3.RELEASE</version>
</dependency>
这是 spring-context
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>4.0.3.RELEASE</version>
</dependency>
关于java - 为eclipse添加spring资源,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23050177/