ZPY博客

运行spring security oauth2.0 github上的例子里报错找不到spring-security-oauth2:jar:2.3.5.BUILD-SNAPSHOT

在官网上下载了spring security oauth2.0的例子,但是运行samples\oauth2\里的sparklr项目时,报错如下:

[WARNING] The requested profile "spring" could not be activated because it does not exist.
[ERROR] Failed to execute goal on project sparklr2: Could not resolve dependencies for project org.springframework.security.oauth:sparklr2:war:2.3.5.BUILD-SNAPSHOT: Failed to collect dependencies at org.springframework.security.oauth:spring-security-oauth2:jar:2.3.5.BUILD-SNAPSHOT: Failed to read artifact descriptor for org.springframework.security.oauth:spring-security-oauth2:jar:2.3.5.BUILD-SNAPSHOT: Failure to find org.springframework.security.oauth:spring-security-oauth-parent:pom:2.3.5.BUILD-SNAPSHOT in http://repo.spring.io/libs-snapshot was cached in the local repository, resolution will not be reattempted until the update interval of spring has elapsed or updates are forced -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException

上面的报错意思很简单,就是找不到spring-security-oauth2:jar:2.3.5.BUILD-SNAPSHOT这个jar包,但是不应该啊,直接从官网下的怎么可能找不到jar包,后来看到snapshot的后缀,心想是不是还是测试阶段,并没有放到maven仓库里,所以找不到。于是在下载的工程里找到了spring-security-oauth2这个项目。

这就简单了,把这个项目导入进来后手动打成jar包。再把jar包加到本地maven仓库即可。注意:这里不能直接复制到本地maven仓库的对应目录里,这样工程里还是不认的。必须用maven命令才行。命令如下:

mvn install:install-file -Dfile=E:\downloads\spring-security-oauth-master\spring-security-oauth-master\spring-security-oauth2\target\spring-security-oauth2-2.3.5.BUILD-SNAPSHOT.jar -DgroupId=org.springframework.security.oauth -DartifactId=spring-security-oauth2 -Dversion=2.3.5.BUILD-SNAPSHOT -Dpackaging=jar

再运行工程就不会报上面找不到jar包的错了。