[英]How to add Spring to new Java Project in Eclipse?
I have Eclipse with m2 plugin and want to make new project with Spring. 我有带m2插件的Eclipse,并且想用Spring创建新项目。 In maven central repo are only Spring 1.x and Spring 2.x versions and adding http://maven.springframework.org/milestone to pom.xml don't change anything.
在maven中央存储库中,只有Spring 1.x和Spring 2.x版本,并将http://maven.springframework.org/milestone添加到pom.xml不会改变任何内容。
I the central repository there are also the latest final Spring artifacts (3.0.5.RELEASE). 在中央存储库中,还有最新的最终Spring构件(3.0.5.RELEASE)。
Eg http://repo1.maven.org/maven2/org/springframework/spring-beans/3.0.5.RELEASE 例如http://repo1.maven.org/maven2/org/springframework/spring-beans/3.0.5.RELEASE
If you need milestones for 3.1 you should add repository definition to your pom.xml as follows: 如果您需要3.1的里程碑,则应将存储库定义添加到pom.xml中,如下所示:
<repository>
<id>spring-maven-milestone</id>
<name>Springframework Maven Milestone Repository</name>
<url>http://maven.springframework.org/milestone</url>
</repository>
And then you can define the dependency: 然后您可以定义依赖项:
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
<version>3.1.0.M2</version>
</dependency>
There is also repository containing snapshots (nightly): 还有一个包含快照的存储库(每晚):
<repository>
<id>spring-maven-snapshot</id>
<snapshots><enabled>true</enabled></snapshots>
<name>Springframework Maven SNAPSHOT Repository</name>
<url>http://maven.springframework.org/snapshot</url>
</repository>
Seems like you want to use springs own repositories, but you need to add them in your settings.xml file (~/.m2/settings.xml), not in the pom.xml in your project. 似乎您想使用springs自己的存储库,但是您需要将它们添加到settings.xml文件(〜/ .m2 / settings.xml)中,而不是添加到项目的pom.xml中。
<repository>
<id>repository.springframework.maven.release</id>
<name>Spring Framework Maven Release Repository</name>
<url>http://maven.springframework.org/release</url>
</repository>
<repository>
<id>repository.springframework.maven.milestone</id>
<name>Spring Framework Maven Milestone Repository</name>
<url>http://maven.springframework.org/milestone</url>
</repository>
<repository>
<id>repository.springframework.maven.snapshot</id>
<name>Spring Framework Maven Snapshot Repository</name>
<url>http://maven.springframework.org/snapshot</url>
</repository>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.