Oauth2样本不起作用,因为依赖性错误

时间:2015-10-13 15:01:48

标签: java maven oauth-2.0

我已从GitHub下载了spring-security-oauth Maven项目,其中包含示例tonr2spaklr2

在所有jar文件下载完毕后,我一直在pom.xml收到错误消息。

<parent>
    <groupId>org.springframework.security.oauth</groupId>
    <artifactId>spring-security-oauth-parent</artifactId>
    <version>2.0.8.BUILD-SNAPSHOT</version>
    <relativePath>../../..</relativePath>
</parent>

在以下依赖项中显示错误。

<dependency>
    <groupId>${project.groupId}</groupId>
    <artifactId>spring-security-oauth2</artifactId>
    <version>${project.version}</version>
</dependency>

错误是:

  

缺少工件org.springframework.security.oauth:spring-security-oauth2:jar:2.0.8.BUILD-SNAPSHOT

运行命令后

mvn install -P bootstrap

我收到了下一个错误:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.
12.4:test (default-test) on project spring-security-oauth2: There are test failu
res.
[ERROR]
[ERROR] Please refer to C:\Users\a.bazaldua.cerda\Desktop\Oauth\spring-security-
oauth-master\spring-security-oauth2\target\surefire-reports for the individual t
est results.
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e swit
ch.
[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 rea
d the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureExc
eption

1 个答案:

答案 0 :(得分:0)

要构建spring-security-oauth项目,首先需要运行以下命令:

mvn clean install -P bootstrap -DskipTests=true

您可以直接在命令行上运行它(这是简单的解决方案)。

如果要直接在Eclipse中执行此操作,则需要创建自定义Maven Build。进入&#34;运行&gt;运行配置......&#34;。双击&#34; Maven Build&#34;创建一个新的自定义Maven构建。给它一个名字,选择你想要构建的项目的工作目录的基目录,选择目标&#34; clean install&#34;和简介&#34; bootstrap&#34;。

完成第一次构建后,在Eclipse中更新Maven项目,您将不再有任何错误。