2013-06-12 93 views
0

我試圖使用maven-scalaest插件,他工作得很好。 問題是結果看起來不好,因爲編碼。 我試圖用eclipse或cmd來使用它,但得到了相同的結果。maven scalaest插件編碼

Image of what i see

聚甲醛是這樣的:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 
<modelVersion>4.0.0</modelVersion> 
<groupId>jp.mwsoft.sample</groupId> 
<artifactId>java-scala-test</artifactId> 
<version>0.0.1-SNAPSHOT</version> 

<properties> 
    <scala-version>2.9.2</scala-version> 
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> 
</properties> 

<dependencies> 
    <dependency> 
     <groupId>org.scala-lang</groupId> 
     <artifactId>scala-compiler</artifactId> 
     <version>${scala-version}</version> 
     <scope>test</scope> 
    </dependency> 
    <dependency> 
     <groupId>junit</groupId> 
     <artifactId>junit</artifactId> 
     <version>4.10</version> 
     <scope>test</scope> 
    </dependency> 
    <dependency> 
     <groupId>org.scalatest</groupId> 
     <!-- 
     <artifactId>scalatest_${scala-version}</artifactId> 
     --> 
     <artifactId>scalatest_2.9.0</artifactId> 
     <version>2.0.M5</version> 
     <scope>test</scope> 
    </dependency> 
</dependencies> 

<build> 
    <sourceDirectory>src/main/java</sourceDirectory> 
    <testSourceDirectory>src/test/scala</testSourceDirectory> 
    <plugins> 
     <plugin> 
      <artifactId>maven-compiler-plugin</artifactId> 
      <configuration> 
       <source>1.6</source> 
       <target>1.6</target> 
      </configuration> 
     </plugin> 
     <plugin> 
      <groupId>org.scala-tools</groupId> 
      <artifactId>maven-scala-plugin</artifactId> 
      <executions> 
       <execution> 
        <id>test-compile</id> 
        <goals> 
         <goal>testCompile</goal> 
        </goals> 
       </execution> 
      </executions> 
     </plugin> 
     <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-M2</version> 
      <configuration> 
       <argLine></argLine> 
      </configuration> 
      <executions> 
       <execution> 
        <goals> 
         <goal>test</goal> 
        </goals> 
       </execution> 
      </executions> 
     </plugin> 
    </plugins> 
</build> 

回答

0

這是因爲scalatest輸出特殊字符設置文本顏色以及諸如此類。這裏是來自linux的截圖。這可能是Eclipse控制檯不知道這些字符是什麼。這裏是來自linux的截圖。

http://s24.postimg.org/zeymeowmd/scrimage.png

+0

你有任何想法如何消除這種顏色嗎? 或者設置eclipse控制檯來處理顏色? –

+1

我發現了一個解決方案如何在此頁面上禁用顏色: [link](http://stackoverflow.com/questions/13036561/trying-to-get-scalatest-working-there-are-no-tests-to -run-when-doing-mvn-tes) –

+0

你有什麼想法我可以在哪裏找到記者文檔? (請給我一個鏈接) –

4

您可以

<stdout>W</stdout> 

等清除顏色outup:

<plugin> 
      <groupId>org.scalatest</groupId> 
      <artifactId>scalatest-maven-plugin</artifactId> 
      <version>1.0-RC2</version> 
      <configuration> 
       <reportsDirectory>${project.build.directory}/scalatest-reports</reportsDirectory> 
       <junitxml>.</junitxml> 
       <stdout>W</stdout> <!-- Skip coloring output --> 
       <encoding>UTF-8</encoding> 
       <htmlreporters>./html</htmlreporters> 
       <filereports>WDF TestSuite.txt</filereports> 
       <membersOnlySuites>test.common</membersOnlySuites> 

      </configuration> 
      <executions> 
       <execution> 
        <id>test</id> 
        <goals> 
         <goal>test</goal> 
        </goals> 
        <configuration> 
          <membersOnlySuites>test.common</membersOnlySuites> 
        </configuration> 
       </execution> 
      </executions> 
     </plugin>