maven 打包时-出现以下提示的处理方法分享(File encoding has not been set, using platform encoding GBK, i.e. build is p
今天笔者使用maven进行打包操作时,出现以下提示信息
“File encoding has not been set, using platform encoding GBK, i.e. build is platform dependent”
“File encoding has not been set, using platform encoding GBK, i.e. build is platform dependent”
编译打包(mvn clean install)文件总是为GBK格式,不是UTF-8格式 ------------------------------------------------------------ 出现以上错误提示的原因,是由于 源代码使用默认编码格式 GBK 我们只需在pom.xml上进行相应的配置 <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> </properties>如:
<build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <version>2.21.0</version> <configuration> <forkMode>once</forkMode> <!-- 解决中文乱码问题 --> <argLine>-Dfile.encoding=UTF-8</argLine> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> </properties> </configuration> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <configuration> <source>1.8</source> <target>1.8</target> </configuration> </plugin> </plugins> </build>
版权声明
本文仅代表作者观点,不代表本站立场。
本文系作者授权发表,未经许可,不得转载。