我使用下面的网站创建了一个maven web项目。
http://www.mkyong.com/maven/how-to-create-a-web-application-project-with-maven/
我已经执行了那里给出的所有步骤,并执行了一个简单的helloworld程序。现在,我必须将spring依赖项包含到我的eclipse web项目中。
所以
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring</artifactId>
<version>3.1.2</version>
</dependency>
在dependencies标签中,我添加了上面的配置。现在,它说如下:
unable to find jars from the repositories (local and as well as remote)
它给出了执行命令的建议:
mvn install -artifactid=springframework (something like this)
但当我提到2.5.6版本时,它是正确的。是不是因为3.1.2版本在maven存储库中不可用?如果maven不能正常工作于最新版本,我该如何获得最新版本?
它还建议我手动下载并放入本地存储库。
Maven坐标随时间变化。
尝试:
<dependency>
<groupId>org.springframework</groupId>
<artifactId>org.springframework.core</artifactId>
<version>3.1.2.RELEASE</version>
</dependency>
或者尝试:
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>3.1.2.RELEASE</version>
</dependency>
我只是想知道是否有一个一体化的POM或依赖关系。但是"spring-full"看起来只有1.2.x,"spring"只有2.5.x。检查:找不到一个我已经在所有项目中使用单独模块一段时间了(无论如何,细粒度依赖关系更好)。
您可以搜索的位置在http://ebr.springsource.com/repository/app/
3.1.2参见http://ebr.springsource.com/repository/app/library/version/detail?name=org.springframework.spring&版本=3.1.2.发布;searchType=librariesByName&searchQuery=春季
据我所知,在过去的4年里,Spring已经更改了他们的存储库URL和在线位置至少3次。因此,我会在他们的网站上查找有关设置Maven<repositories>
配置以获取他们的JAR的最新信息。小心信息过期的文章:(
另外请注意,artifactId在2个示例中有所不同,这是spring的另一个棘手问题。"org.springframework.core"是他们软件的EBR和OSGi兼容版本。"spring-core"是较早的OSGi之前的坐标。找到适合你的方法,不要把它们混合在同一个项目中。例如,我使用"spring-core",因为我使用了3.2.0.M2,这是里程碑版本。但生产发布的EBR坐标是最好使用的。
很抱歉编辑了这么多。。。但是,即使您了解获取SpringSource软件的传统,它也一直是一个雷区。