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

时间:2016-11-01 09:45:46

标签: java maven sakai

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

  • Sakai 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

1 个答案:

答案 0 :(得分:1)

  

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

     

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