Maven Clojure 插件未 运行 测试

Maven Clojure Plugin Not Running Tests

我正在尝试使用 Java、Scala 和 Clojure 的 Maven 创建一个简单的项目。我对每种语言都有简单的测试 类,但是当 运行ning 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 或 Scala 测试中出现测试失败,Clojure 插件将不会 运行。但是,如果所有 Java 和 Scala 测试都通过了,它将 运行 Clojure 测试按预期进行。

我已经使用插件登录 an issue