0

我尝试使用 maven-scalaest-plugin 并且他运行良好。问题是结果看起来不太好,因为编码。我曾尝试将它与 eclipse 或 cmd 一起使用,但得到了相同的结果。

我所看到的图像

pom是这样的:

<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>

4

2 回答 2

5

您可以使用 outup 删除颜色

<stdout>W</stdout>

喜欢:

<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>
于 2014-05-12T14:25:32.680 回答
0

这是因为 scalatest 输出特殊字符来设置文本颜色等。这是来自linux的屏幕截图。可能是 Eclipse 控制台不知道字符是什么。这是来自linux的屏幕截图。

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

于 2013-06-12T19:43:36.930 回答