1
使用scalatest時遇到了一個奇怪的問題。我有一個包含多個模塊的maven項目。如果我直接在模塊中執行mvn test
。它工作沒有問題,但如果我在根文件夾中執行它,它抱怨在編譯時丟失包(依賴項)。Maven模塊無法使用scalatest查找依賴關係
我的配置看起來像如下:
<dependency>
<groupId>org.scalatest</groupId>
<artifactId>scalatest_${scala.shortversion}</artifactId>
<version>3.0.0-SNAP2</version>
</dependency>
<dependency>
<groupId>org.scalatest</groupId>
<artifactId>scalatest-maven-plugin</artifactId>
<version>1.0</version>
</dependency>
插件配置:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.7</version>
<configuration>
<skipTests>true</skipTests>
</configuration>
</plugin>
<plugin>
<groupId>org.scalatest</groupId>
<artifactId>scalatest-maven-plugin</artifactId>
<version>1.0</version>
<configuration>
<reportsDirectory>${project.build.directory}/surefire-reports</reportsDirectory>
<junitxml>.</junitxml>
<filereports>WDF TestSuite.txt</filereports>
</configuration>
<executions>
<execution>
<id>scala-test</id>
<goals>
<goal>test</goal>
</goals>
</execution>
</executions>
</plugin>
如果我從maven-scala-plugin
的goals
刪除它會編譯,但scalatest將找不到測試源和退出與No tests were executed.
:
<plugin>
<version>2.15.2</version>
<groupId>org.scala-tools</groupId>
<artifactId>maven-scala-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>compile</goal>
<goal>testCompile</goal>
</goals>
</execution>
</executions>
<configuration>
<scalaVersion>${scala.version}</scalaVersion>
</configuration>
</plugin>
關於我做錯什麼的想法?
乾杯
我繼承了這個項目,不得不清理很多東西。當我重組根目錄中的'pluginManagement'時,我的問題得到了解決。感謝提示! – zio 2014-11-06 14:03:36