• 编码GBK的不可映射字符


    1、错误描写叙述

    [ERROR] /E:/Eclipse/workspace/huxs/src/test/java/com/you/huxs/utils/SpringTestBase.java:[14,12] 编码GBK的不可映射字符
    [ERROR] /E:/Eclipse/workspace/huxs/src/test/java/com/you/huxs/utils/SpringTestBase.java:[15,6] 编码GBK的不可映射字符
    [ERROR] /E:/Eclipse/workspace/huxs/src/test/java/com/you/huxs/utils/SpringTestBase.java:[19,12] 编码GBK的不可映射字符
    [ERROR] /E:/Eclipse/workspace/huxs/src/test/java/com/you/huxs/utils/SpringTestBase.java:[19,17] 编码GBK的不可映射字符
    [ERROR] /E:/Eclipse/workspace/huxs/src/test/java/com/you/huxs/utils/SpringTestBase.java:[19,19] 编码GBK的不可映射字符
    [ERROR] /E:/Eclipse/workspace/huxs/src/test/java/com/you/huxs/utils/SpringTestBase.java:[19,22] 编码GBK的不可映射字符
    [ERROR] /E:/Eclipse/workspace/huxs/src/test/java/com/you/huxs/utils/SpringTestBase.java:[20,12] 编码GBK的不可映射字符
    [ERROR] /E:/Eclipse/workspace/huxs/src/test/java/com/you/huxs/utils/SpringTestBase.java:[30,16] 编码GBK的不可映射字符
    [ERROR] /E:/Eclipse/workspace/huxs/src/test/java/com/you/huxs/utils/SpringTestBase.java:[30,39] 编码GBK的不可映射字符
    [ERROR] /E:/Eclipse/workspace/huxs/src/test/java/com/you/huxs/utils/SpringTestBase.java:[31,16] 编码GBK的不可映射字符
    [ERROR] /E:/Eclipse/workspace/huxs/src/test/java/com/you/huxs/utils/SpringTestBase.java:[31,21] 编码GBK的不可映射字符
    [ERROR] /E:/Eclipse/workspace/huxs/src/test/java/com/you/huxs/utils/SpringTestBase.java:[31,23] 编码GBK的不可映射字符
    [ERROR] /E:/Eclipse/workspace/huxs/src/test/java/com/you/huxs/utils/SpringTestBase.java:[31,26] 编码GBK的不可映射字符
    [ERROR] /E:/Eclipse/workspace/huxs/src/test/java/com/you/huxs/utils/SpringTestBase.java:[32,14] 编码GBK的不可映射字符
    [ERROR] /E:/Eclipse/workspace/huxs/src/test/java/com/you/huxs/utils/SpringTestBase.java:[36,16] 编码GBK的不可映射字符
    [ERROR] /E:/Eclipse/workspace/huxs/src/test/java/com/you/huxs/utils/SpringTestBase.java:[6,24] 程序包org.junit.runner不存在
    [ERROR] /E:/Eclipse/workspace/huxs/src/test/java/com/you/huxs/utils/SpringTestBase.java:[7,40] 程序包org.springframework.test.context不存在
    [ERROR] /E:/Eclipse/workspace/huxs/src/test/java/com/you/huxs/utils/SpringTestBase.java:[8,47] 程序包org.springframework.test.context.junit4不存在
    [ERROR] /E:/Eclipse/workspace/huxs/src/test/java/com/you/huxs/utils/SpringTestBase.java:[9,52] 程序包org.springframework.test.context.transaction不存在
    [ERROR] /E:/Eclipse/workspace/huxs/src/test/java/com/you/huxs/utils/SpringTestBase.java:[10,50] 程序包org.springframework.transaction.annotation不存在
    [ERROR] /E:/Eclipse/workspace/huxs/src/test/java/com/you/huxs/utils/SpringTestBase.java:[22,2] 找不到符号
      符号: 类 RunWith
    [ERROR] /E:/Eclipse/workspace/huxs/src/test/java/com/you/huxs/utils/SpringTestBase.java:[23,2] 找不到符号
      符号: 类 ContextConfiguration
    [ERROR] /E:/Eclipse/workspace/huxs/src/test/java/com/you/huxs/utils/SpringTestBase.java:[24,2] 找不到符号
      符号: 类 Transactional
    [ERROR] /E:/Eclipse/workspace/huxs/src/test/java/com/you/huxs/utils/SpringTestBase.java:[25,2] 找不到符号
      符号: 类 TransactionConfiguration
    [INFO] 24 errors 
    [INFO] -------------------------------------------------------------
    [INFO] ------------------------------------------------------------------------
    [INFO] BUILD FAILURE
    [INFO] ------------------------------------------------------------------------
    [INFO] Total time: 2.486 s
    [INFO] Finished at: 2016-01-12T17:59:17+08:00
    [INFO] Final Memory: 11M/171M
    [INFO] ------------------------------------------------------------------------
    [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:testCompile (default-testCompile) on project huxs: Compilation failure: Compilation failure:
    [ERROR] /E:/Eclipse/workspace/huxs/src/test/java/com/you/huxs/utils/SpringTestBase.java:[14,12] 编码GBK的不可映射字符
    [ERROR] /E:/Eclipse/workspace/huxs/src/test/java/com/you/huxs/utils/SpringTestBase.java:[15,6] 编码GBK的不可映射字符
    [ERROR] /E:/Eclipse/workspace/huxs/src/test/java/com/you/huxs/utils/SpringTestBase.java:[19,12] 编码GBK的不可映射字符
    [ERROR] /E:/Eclipse/workspace/huxs/src/test/java/com/you/huxs/utils/SpringTestBase.java:[19,17] 编码GBK的不可映射字符
    [ERROR] /E:/Eclipse/workspace/huxs/src/test/java/com/you/huxs/utils/SpringTestBase.java:[19,19] 编码GBK的不可映射字符
    [ERROR] /E:/Eclipse/workspace/huxs/src/test/java/com/you/huxs/utils/SpringTestBase.java:[19,22] 编码GBK的不可映射字符
    [ERROR] /E:/Eclipse/workspace/huxs/src/test/java/com/you/huxs/utils/SpringTestBase.java:[20,12] 编码GBK的不可映射字符
    [ERROR] /E:/Eclipse/workspace/huxs/src/test/java/com/you/huxs/utils/SpringTestBase.java:[30,16] 编码GBK的不可映射字符
    [ERROR] /E:/Eclipse/workspace/huxs/src/test/java/com/you/huxs/utils/SpringTestBase.java:[30,39] 编码GBK的不可映射字符
    [ERROR] /E:/Eclipse/workspace/huxs/src/test/java/com/you/huxs/utils/SpringTestBase.java:[31,16] 编码GBK的不可映射字符
    [ERROR] /E:/Eclipse/workspace/huxs/src/test/java/com/you/huxs/utils/SpringTestBase.java:[31,21] 编码GBK的不可映射字符
    [ERROR] /E:/Eclipse/workspace/huxs/src/test/java/com/you/huxs/utils/SpringTestBase.java:[31,23] 编码GBK的不可映射字符
    [ERROR] /E:/Eclipse/workspace/huxs/src/test/java/com/you/huxs/utils/SpringTestBase.java:[31,26] 编码GBK的不可映射字符
    [ERROR] /E:/Eclipse/workspace/huxs/src/test/java/com/you/huxs/utils/SpringTestBase.java:[32,14] 编码GBK的不可映射字符
    [ERROR] /E:/Eclipse/workspace/huxs/src/test/java/com/you/huxs/utils/SpringTestBase.java:[36,16] 编码GBK的不可映射字符
    [ERROR] /E:/Eclipse/workspace/huxs/src/test/java/com/you/huxs/utils/SpringTestBase.java:[6,24] 程序包org.junit.runner不存在
    [ERROR] /E:/Eclipse/workspace/huxs/src/test/java/com/you/huxs/utils/SpringTestBase.java:[7,40] 程序包org.springframework.test.context不存在
    [ERROR] /E:/Eclipse/workspace/huxs/src/test/java/com/you/huxs/utils/SpringTestBase.java:[8,47] 程序包org.springframework.test.context.junit4不存在
    [ERROR] /E:/Eclipse/workspace/huxs/src/test/java/com/you/huxs/utils/SpringTestBase.java:[9,52] 程序包org.springframework.test.context.transaction不存在
    [ERROR] /E:/Eclipse/workspace/huxs/src/test/java/com/you/huxs/utils/SpringTestBase.java:[10,50] 程序包org.springframework.transaction.annotation不存在
    [ERROR] /E:/Eclipse/workspace/huxs/src/test/java/com/you/huxs/utils/SpringTestBase.java:[22,2] 找不到符号
    [ERROR] 符号: 类 RunWith
    [ERROR] /E:/Eclipse/workspace/huxs/src/test/java/com/you/huxs/utils/SpringTestBase.java:[23,2] 找不到符号
    [ERROR] 符号: 类 ContextConfiguration
    [ERROR] /E:/Eclipse/workspace/huxs/src/test/java/com/you/huxs/utils/SpringTestBase.java:[24,2] 找不到符号
    [ERROR] 符号: 类 Transactional
    [ERROR] /E:/Eclipse/workspace/huxs/src/test/java/com/you/huxs/utils/SpringTestBase.java:[25,2] 找不到符号
    [ERROR] 符号: 类 TransactionConfiguration
    [ERROR] -> [Help 1]
    [ERROR] 
    [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
    [ERROR] Re-run Maven using the -X switch to enable full debug logging.
    [ERROR] 
    [ERROR] For more information about the errors and possible solutions, please read the following articles:
    [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
    

    2、错误原因

         因为将项目从SVN上检出的编码格式是UTF-8,Maven编译时使用的是GBK编码。两个编码不一致导出出错


    3、解决的方法

         在pom.xml中加入编码格式:

    <plugin>  
        <groupId>org.apache.maven.plugins</groupId>  
        <artifactId>maven-compiler-plugin</artifactId>  
        <version>3.3.1</version>  
        <configuration>  
            <source>1.7</source>  
            <target>1.7</target>  
            <encoding>utf8</encoding>    
        </configuration>  
    </plugin>  


  • 相关阅读:
    C++小结
    进程
    JavaScript中如何获取当前点击对象信息!
    form表单中enctype="multipart/form-data"的传值问题
    WebMagic框架总结
    工具类:自己总结的利用fileupload包上传文件的工具类!
    工具类:关于如何找到两个List数组中不同的数据的算法!
    工具类:关于解决数据库中的日期格式,经过response.getWriter().write(json)打到前台日期格式混乱的问题的总结
    工具类:将其他编码类型转换成UTF-8或者其他类型的工具类
    博主收藏的前端框架,极力推荐!
  • 原文地址:https://www.cnblogs.com/cxchanpin/p/7374057.html
Copyright © 2020-2023  润新知