购买了 Spring 数据手册并尝试在 STS 上"mvn 安装"示例代码,并具有以下内容:
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
这是 Maven 输出
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO]
[INFO] Spring Data Book
[INFO] Spring Data Book - JPA
[INFO] Spring Data Book - MongoDB
[INFO] Spring Data Book - Querydsl
[INFO] Spring Data Book - Neo4J
[INFO] Spring Data Book - JDBC
[INFO] Spring Data Book - Redis
[INFO] Spring Data Book - GemFire
[INFO] Spring Data Book - REST exporter
[INFO]
[INFO]
[INFO] Building Spring Data Book 1.0.0.BUILD-SNAPSHOT
[INFO]
[INFO] Installing C:spring-data-bookpom.xml to C:UsersA27L4PT.m2repositorycomoreillyspringdataspring-data-book1.0.0.BUILD-SNAPSHOTspring-data-book-1.0.0.BUILD-SNAPSHOT.pom
[INFO]
[INFO]
[INFO] Building Spring Data Book - JPA 1.0.0.BUILD-SNAPSHOT
[INFO
[WARNING] The POM for org.apache.maven.plugins:maven-surefire-plugin:jar:2.1.6 is missing, no dependency information available
[INFO]
[INFO] Reactor Summary:
[INFO]
[INFO] Spring Data Book .................................. SUCCESS [3.292s]
[INFO] Spring Data Book - JPA ............................ FAILURE [0.074s]
[INFO] Spring Data Book - MongoDB ........................ SKIPPED
[INFO] Spring Data Book - Querydsl ....................... SKIPPED
[INFO] Spring Data Book - Neo4J .......................... SKIPPED
[INFO] Spring Data Book - JDBC ........................... SKIPPED
[INFO] Spring Data Book - Redis .......................... SKIPPED
[INFO] Spring Data Book - GemFire ........................ SKIPPED
[INFO] Spring Data Book - REST exporter .................. SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.592s
[INFO] Finished at: Mon Feb 17 11:34:55 EST 2014
[INFO] Final Memory: 5M/15M
[INFO] ------------------------------------------------------------------------
[ERROR] Plugin org.apache.maven.plugins:maven-surefire-plugin:2.1.6 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-surefire-plugin:jar:2.1.6: Failure to find org.apache.maven.plugins:maven-surefire-plugin:pom:2.1.6 in http://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central 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]
为您的命运增添万无一失。
<dependency>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.16</version>
</dependency>
此版本可能是错误的。在 http://mvnrepository.com/artifact/org.apache.maven.plugins/maven-surefire-plugin 上找不到 2.1.6
显然其中一个
源文件中有拼写错误。在所有pom.xml文件中搜索"2.16",并在确认您正在处理Surefire插件版本后,将其更改为"2.1.6",这是截至今天的最新有效版本。
如果在 pom 文件中找不到对此版本的任何引用,请将插件管理部分添加到根 pom.xml:
<build>
...
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.1.6</version>
</plugin>
</plugins>
</pluginManagement>
...
</build>