Maven: Source Encoding in UTF-8 not working?

后端 未结 5 663
南旧
南旧 2020-12-13 03:38

i am converting a project from Ant to Maven and i\'m having problems with a specific unit test which deals with UTF-8 characters. The problem is about the following String:<

5条回答
  •  清歌不尽
    2020-12-13 04:14

    I have found a "solution" myself:

    I had to pass the encoding into the maven-surefire-plugin, but the usual

    ${project.build.sourceEncoding}
    

    did not work. I still have no idea why, but when i pass the command line arguments into the plugin, the tests works as they should:

    
          org.apache.maven.plugins
          maven-surefire-plugin
          2.15
          
            -Dfile.encoding=UTF-8
          
    
    

    Thanks for all your responses and additional comments!

提交回复
热议问题