Maven4Myeclipse10.7.1搭建SSH2-part3:创建MavenSpring3.2.2

使用Maven仓库导入Spring包,跟普通的步骤有一点不同。先别急着导入。

打开spring官方的某个页面看到一段相对醒目的文字:


标题说:解决Maven校验Spring Framework Artifacts(Artifacts:Maven的项目名称唯一标识)不通过的问题

如果你没看到这段文字,而直接声明导入Spring的包,就会杯具地发现Maven提示pom.xml校验不通过。

具体原因不清楚,Spring官网也没有找到相关说明。Spring官方只提供了相关的导入步骤和解决办法。

详见:点击打开链接


先给pom.xml添加Spring包

<dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-context</artifactId>
      <version>3.2.2.RELEASE</version>
</dependency>

添加后会提示pom.xml无法通过校验。

接着就是重点,导入步骤里面说到了:

We used the Maven Central naming conventions in the example above, so that works with Maven Central or the SpringSource S3 Maven repository. To use the S3 Maven repository (e.g. for milestones or developer snapshots), you need to specify the repository location in your Maven configuration. 

大致是说:上面的例子我们用到了 Maven Central的命名规范,所以这用到了Maven Central或者SpringSource S3 Maven仓库。要用S3 Maven 仓库(例如:milestones 、developer ),你要在Maven配置一个repository location (仓库路径)。


也就是说要给Maven配置一下。

Maven的配置文件可以在这里找到:


没settings.xml这个配置文件的可以创建一个:

    <settings 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  
                                   http://maven.apache.org/xsd/settings-1.0.0.xsd">  
	<repositories>
   		<repository>
	      		<id>com.springsource.repository.maven.release</id>
	      		<url>http://repo.springsource.org/release/</url>
	      		<snapshots><enabled>false</enabled></snapshots>
	   	</repository>
	</repositories>
    </settings>  

按步骤进行操作,应该没问题了。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值