maven, install 时候报错“编码 gbk 的不可映射字符”的解决方法

myeclipse maven, install 时候报错“编码 gbk 的不可映射字符”

报错的原因是compiler采用了GBK编码,而源代码设置的是utf8编码导致编译的时候无法正确解析源码,解决方法很简单,在pom的compiler插件配置处加入<encoding>utf8</encoding> 即可,如下:

 

<build>
        <plugins>
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>1.7</source>
                    <target>1.7</target>
                    <encoding>utf8</encoding>
                </configuration>
            </plugin>
            <plugin>
                <artifactId>maven-surefire-plugin</artifactId>
                <configuration>
                    <includes>
                        <include>**/*Tests.java</include>
                    </includes>
                </configuration>
            </plugin>
        </plugins>
    </build>

你可能感兴趣的:(maven,gbk,不可映射字符)