I am trying to compile a Maven Java project with files saved as UTF-8 that have a BOM, but I am getting an illegal character error from the BOM character in the despite I having both the project.build.sourceEncoding
as well as the encoding
of the maven-compiler-plugin
set to UTF-8
.
Am I missing an additional setting? Can I even get this to compile without removing the BOM (not allowed to make any change to the source, but I can modify the POM)?
The error:
java: C:\code\main\src\test\java\net\initech\finance\FinanceTest.java:1: illegal character: \65279
The property:
<properties>
...
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
...
</properties>
The plugin:
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
</plugins>
</build>