在命令行中运行mvn compile 报错:
解决方法:
方式一:
使用maven-compiler-plugin插件,指定编码:
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-compiler-plugin</artifactId>
- <configuration>
- <source>1.6</source>
- <target>1.6</target>
- <encoding>UTF-8</encoding>
- </configuration>
- </plugin>
方式二:
<properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> </properties> |
<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <configuration> <source>1.6</source> <target>1.6</target> </configuration> </plugin> |
注意:
(1)plugin标签在plugins标签中;
(2)properties标签在project标签下