【问题标题】:Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.16:test error in SAKAI无法执行目标 org.apache.maven.plugins:maven-surefire-plugin:2.16:test 错误在 SAKAI
【发布时间】:2016-11-01 09:45:46
【问题描述】:

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

  • 酒井10.7
  • Maven 3.3.1
  • Tomcat 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

【问题讨论】:

    标签: java maven sakai


    【解决方案1】:

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

    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
    

    【讨论】:

    • 首先非常感谢,您建议的第二个解决方案解决了我的问题,但为什么无法在 .m2 文件夹中创建存储库文件夹?
    • 如果你提供完整的日志,我可以猜测一下。对于初学者,您可以检查日志中的 [INSTALL] 标签。这向您显示了将要保存 jar 的路径。如果您找不到任何带有 [INSTALL] 的行,那么 Maven 可能会根据失败的测试取消依赖项的下载。文件夹也可以被隐藏,也许。
    猜你喜欢
    • 1970-01-01
    • 2019-05-08
    • 2016-07-25
    • 1970-01-01
    • 1970-01-01
    • 2012-10-21
    • 2015-09-22
    • 1970-01-01
    • 2017-01-23
    相关资源
    最近更新 更多