0

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

  • 堺 10.7
  • Maven 3.3.1
  • 雄猫 7.0.72

[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
4

1 回答 1

1

有时某些测试会导致构建失败。排除它们是继续构建的最佳解决方法之一。可以通过配置插件的 excludes 属性来完成排除。

Maven Surefire 插件 / 测试的包含和排除

我的解决方案是在 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
于 2016-11-01T10:21:52.243 回答