【问题标题】:adding spring resources to eclipse将spring资源添加到eclipse
【发布时间】:2014-05-27 19:51:51
【问题描述】:

我正在努力将 spring framework 库添加到我的 Eclipse(使用 maven 插件 m2eclipse) 我怎样才能以最简单的方式实现它,为什么对于新手用户来说如此复杂? 像这样简单的事情我无法继续前进,这真的很令人沮丧。

主要目标是将 spring 库添加到我的 depedencies 选项卡中的 pom.xml 文件中我的 dynamic web project 在 Eclipse 中。 Pom.xml 是由 maven plug-in 生成的。

首先,我移至Eclipse Marketplace 并安装了Spring Tool Suite for Eclipse Kepler 4.3,结果什么都没有——仍然无法添加库。第二次尝试为我的整个窗户安装相同的套件,到目前为止没有任何效果。

示例截图(我只能添加这个):

spring-web、spring-context、spring-webmvc 等在哪里?对我来说这是晚上,我没有新的眼光,但我在这里错过了什么?

【问题讨论】:

  • 也许您的意思是在“添加依赖项”视图中搜索时似乎找不到任何弹簧罐?这与它们在 maven2 上不可用不同。您可能没有索引存储库,因此无法在其中搜索..我认为这是在某处的首选项/maven 下设置的。

标签: java eclipse spring maven m2eclipse


【解决方案1】:

我在 Eclipse 中使用 Spring Framework 和 Java 已经有一段时间了。老实说,pom.xml 的 UI 完全烂透了。只需避免 Maven 的 Eclipse UI 并操作原始 XML。它非常直观且功能强大。

所以如果你想添加一个依赖,开始使用mvnrepository。从那里你可以得到你需要的所有依赖sn-ps。

对于'spring-web'插入

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

&lt;dependencies&gt;&lt;/dependencies&gt; 部分。你已经准备好了。

对 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>

【讨论】:

    猜你喜欢
    • 2013-05-14
    • 1970-01-01
    • 2016-08-27
    • 2015-11-27
    • 1970-01-01
    • 1970-01-01
    • 2014-12-04
    • 1970-01-01
    • 2013-04-12
    相关资源
    最近更新 更多