maven编译文件的编码设置如下:
- <plugin>
- <artifactId>maven-compiler-plugin</artifactId>
- <configuration>
- <source>1.5</source>
- <target>1.5</target>
- <encoding>UTF-8</encoding>
- </configuration>
- </plugin>
可以通过 <encoding>UTF-8</encoding> 来设置,如果不设置的话会用本地操作系统的编码来编译文件。
资源文件的编码设置如下:
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-resources-plugin</artifactId>
- <version>2.3</version>
- <configuration>
- <encoding>UTF-8</encoding>
- </configuration>
- </plugin>
转载于:https://blog.51cto.com/tangjj/350795