【问题标题】:maven scalaest plugin encodingmaven scalaest 插件编码
【发布时间】:2013-06-08 16:13:10
【问题描述】:

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

Image of what i see

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>

【问题讨论】:

    标签: eclipse scala maven scalatest


    【解决方案1】:

    你可以在 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>
    

    【讨论】:

      【解决方案2】:

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

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

      【讨论】:

      • 你知道如何去除这些颜色吗?还是设置 eclipse 控制台来处理颜色?
      • 我找到了如何在此页面上禁用颜色的解决方案:link
      • 你知道我在哪里可以找到记者文件吗? (请给我一个链接)
      • 它是负责输出而不是 maven 插件的 scalatest。这里有几个开关:scalatest.org/user_guide/using_scalatest_with_sbt 但我只能找到这些。
      猜你喜欢
      • 2011-07-04
      • 1970-01-01
      • 2011-01-16
      • 1970-01-01
      • 2018-05-29
      • 1970-01-01
      • 1970-01-01
      • 2018-01-19
      • 1970-01-01
      相关资源
      最近更新 更多