【问题标题】:Maven Clojure Plugin Not Running TestsMaven Clojure 插件未运行测试
【发布时间】:2015-06-18 05:21:15
【问题描述】:

我正在尝试使用 Java、Scala 和 Clojure 的 maven 创建一个简单的项目。我对每种语言都有简单的测试类,但是在运行mvn test 时,clojure 测试没有执行。

我正在使用 clojure-maven-plugin 编译和测试 clojure 代码,当运行 mvn 目标 mvn clojure:test-with-junit 时,它按预期运行,我得到以下输出:

[INFO] --- clojure-maven-plugin:1.3.20:test-with-junit (default-cli) @ functional-programming-patterns ---
Tests run: 2, Assertions: 1, Failures: 1, Errors: 0
There are test failures.

不过,当我只运行 mvn test 时,我只能运行 Java 和 Scala 测试:

Running main.HelloWorldJavaTest
Tests run: 2, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.06 sec <<< FAILURE!
Running main.HelloWorldScalaTest
Tests run: 2, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.312 sec <<< FAILURE!

Results :

Failed tests:   fail(main.HelloWorldJavaTest): expected:<1> but was:<2>

Tests in error:
  fail(main.HelloWorldScalaTest): 1 did not equal 2

Tests run: 4, Failures: 1, Errors: 1, Skipped: 0

我的plugin配置如下:

<plugin>
    <groupId>com.theoryinpractise</groupId>
    <artifactId>clojure-maven-plugin</artifactId>
    <version>1.3.20</version>
    <extensions>true</extensions>
    <executions>
        <execution>
            <id>clojure-compile</id>
            <phase>compile</phase>
            <goals>
                <goal>add-source</goal>
                <goal>compile</goal>
            </goals>
            <configuration>
                <sourceDirectories>
                    <sourceDirectory>src/main/clojure</sourceDirectory>
                </sourceDirectories>
            </configuration>
        </execution>
        <execution>
            <id>clojure-test</id>
            <phase>test</phase>
            <goals>
                <goal>test-with-junit</goal>
            </goals>
            <configuration>
                <testSourceDirectories>
                    <testSourceDirectory>src/test/clojure</testSourceDirectory>
                </testSourceDirectories>
            </configuration>
        </execution>
    </executions>
    <configuration>
        <sourceDirectories>
            <sourceDirectory>src/main/clojure</sourceDirectory>
        </sourceDirectories>
        <testSourceDirectories>
            <testSourceDirectory>src/test/clojure</testSourceDirectory>
        </testSourceDirectories>
    </configuration>
</plugin>

我只是想知道插件中是否缺少某些东西,导致我的 Clojure 测试在我的 Scala 和 Java 测试都运行时无法运行。

更新

我一直在玩这个,它似乎没有正确绑定到mvn test 阶段。当我将插件绑定的阶段从test 切换到process-test-resources 时,测试运行良好。但是,由于我的测试失败,Java 和 Scala 的测试没有运行。

【问题讨论】:

    标签: java maven junit clojure maven-3


    【解决方案1】:

    经过反复试验,我发现如果 Java 或 Scala 测试中出现测试失败,Clojure 插件将无法运行。但是,如果所有 Java 和 Scala 测试都通过了,它将按预期运行 Clojure 测试。

    我已使用插件登录an issue

    【讨论】:

      猜你喜欢
      • 2023-03-10
      • 1970-01-01
      • 1970-01-01
      • 2021-05-16
      • 1970-01-01
      • 2016-12-06
      • 1970-01-01
      • 2011-01-12
      • 1970-01-01
      相关资源
      最近更新 更多