无法执行目标 org.apache.maven.plugins:maven-surefire-plugin:2.16:SAKAI 中的测试错误

Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.16:test error in SAKAI

当我尝试使用 Maven 构建 SAKAI 时遇到以下错误。有没有人遇到同样的问题?此外,首先我在 sakai 源文件夹 (sakai-src) 中构建主文件夹,通常 .m2 文件夹 (c:/user/pc-user/.m2) 中应该有一个名为 repository 的文件夹,但不存在。


[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.16:test (default-test) on project external-calendaring-service-impl: There are test failures.
[ERROR]
[ERROR] Please refer to C:\apache\sakai-src\external-calendaring-service\impl\target\surefire-reports for the individual test results.
[ERROR] -> [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/MojoFailureException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR]   mvn <goals> -rf :external-calendaring-service-impl

There are certain times when some tests are causing the build to fail. Excluding them is one of the best workarounds to continue the build. Exclusions can be done by configuring the excludes property of the plugin.

Maven Surefire Plugin / Inclusions and Exclusions of Tests

我的解决方案是在 C:\apache\sakai-src\external-calendaring-service\impl\target\surefire-reports 中检查失败的测试,并在 pom.xml.

中排除它们
  <project>
      [...]
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>2.19.1</version>
            <configuration>
              <excludes>
                <exclude>**/TestCircle.java</exclude>
                <exclude>**/TestSquare.java</exclude>
              </excludes>
            </configuration>
          </plugin>
        </plugins>
      </build>
      [...]
    </project>

另一个解决方案可能是 运行 以下 Maven 命令:

mvn clean install -X -e -DskipTests