maven File encoding has not been set

原pom.xml配置文件:


<?xml version="1.0" encoding="UTF-8"?>
<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>com.my.helloworld</groupId>
<artifactId>hello-world</artifactId>
<version>1.0-SNAPSHOT</version>
<name>Maven Hello World Project</name>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.7</version>
<scope>test</scope>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
</plugins>
</build>

</properties>
</project>

修改后的pom.xml配置文件:


<?xml version="1.0" encoding="UTF-8"?>
<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>com.my.helloworld</groupId>
<artifactId>hello-world</artifactId>
<version>1.0-SNAPSHOT</version>
<name>Maven Hello World Project</name>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.7</version>
<scope>test</scope>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
</plugins>
</build>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
</project>

增加了一个属性的设置。

maven File encoding has not been set,码迷,mamicode.com

时间: 2024-08-04 18:35:53

maven File encoding has not been set的相关文章

解决maven打包编译出现File encoding has not been set问题

maven打包编译时后台一直输出警告信息 [WARNING] File encoding has not been set, using platform encoding GBK, i.e. build is platform dependent! 找了半天,原来只要在pom.xml文件中增加一个配置项即可 <properties>         <project.build.sourceEncoding>UTF-8</project.build.sourceEncodi

Jenkins maven 构建乱码,修改file.encoding系统变量编码为UTF-8

一切都是windows的控制台默认编码GBK问题 情景: 使用jenkins构建,console 输出的中文乱码.代码编码格式是utf-8,因为Jenkins会默认读取当前系统的编码格式,导致构建日志乱码和selenium自动化测试输入的中文乱码. 控制台输出乱码 摸索 不能忍,果断百度一下,按照设置全局配置那里设置LANG :zn_CH.utf-8 无效. 在jenkins下的jenkins.xml设置什么启动为utf-8也是无效. 但是查找资料期间发现,jenkins系统管理的系统信息  想

how to solve &quot;[WARNING] File encoding has not been set, using platform encoding Cp1252, i.e. build is platform dependent!&quot;

[WARNING] File encoding has not been set, using platform encoding Cp1252, i.e. build is platform dependent! Saw this warning message when using failsafe maven plugin, found the fix after a little search. add following to pom.xml <properties> <pro

eclipse的使用-------Text File Encoding没有GBK选项的设置

2013-12-25 09:48:06 标签:java myeclipse使用 有一个项目是使用GBK编码的,在导入到Myeclipse10之后,由于我整个eclipse环境是UTF-8编码的,从而导致中文乱码. 解决办法: 右键项目->Properties->Text File Encoding中没有GBK这个选项.此时你可以手动输入编码方式,如输入GBK,然后点确定,编码格式就成为GBK了,解决了中文乱码问题.

系统变量file.encoding对Java的运行影响有多大?(转)good

这个话题来自: Nutz的issue 361 在考虑这个issue时, 我一直倾向于使用系统变量file.encoding来改变JVM的默认编码. 今天,我想到, 这个系统变量,对JVM的影响到底有多大呢? 我使用最简单的方法看看这个变量的影响--在JDK 1.6.0_20的src.zip文件中,查找包含file.encoding字眼的文件. 共找到4个, 分别是: 先上重头戏 java.nio.Charset类: public static Charset defaultCharset() {

jvm file.encoding 属性引起的storm/hbase乱码

1. 问题 今天为storm程序添加了一个计算bolt,上线后正常,结果发现之前的另一个bolt在将中文插入到hbase中后查询出来乱码.其中字符串是以UTF-8编码的url加密串,然后我使用的URLDecoder.decode(str, "UTF-8")解码,最后插入到hbase中. 2. 排查 (1)hbase中的数据传输都是使用的UTF-8,因此肯定不会出问题,故排除hbase端的问题: (2)既然在测试的时候没乱码,线上却乱码,想到肯定是线上机子jvm环境的问题: (3)确定了

系统属性file.encoding在JVM启动后,再次设置无法对系统的默认编码造成影响

原因和解决方法: https://bugs.java.com/bugdatabase/view_bug.do?bug_id=4163515 https://stackoverflow.com/questions/361975/setting-the-default-java-character-encoding/362006#362006 file.encoding由谁设置? 首先file.encoding是一个系统属性.可以在启动JVM 前设置 如: java -Dfile.encoding=

eclispe设置workspace text file encoding

在windows下开发,经常会遇到eclipse新导入的工程 java代码中的注释或者字符串中文显示乱码,每次都要一个个项目更改麻烦,特地找了下,可通过如下方法一次性设置.

maven常用插件集

<?xml version="1.0" encoding="UTF-8"?> <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 htt