2015-04-13 122 views
3

我正在尝试使用Java,Scala和Clojure的maven创建一个简单的项目。我为每种语言都有简单的测试类,但是在运行mvn test时,clojure测试未执行。Maven 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运行时都无法运行。

UPDATE

我一直在玩这个周围多一些,看来,它没有正确绑定到mvn test阶段。当我切换阶段时,插件从test连接到process-test-resources,测试运行得很好。但是,由于我的测试失败,Java和Scala不能运行。

回答

0

经过一些试验和错误之后,我发现如果在Java或Scala测试中出现测试失败,Clojure插件将不会运行。但是,如果所有Java和Scala测试都通过了,它将按预期运行Clojure测试。

我已经登录an issue与插件。