我有几个使用Cp1252编码的Maven模块。在其中一个模块中加入scala后,就遇到了问题。Scala-Maven插件忽略
我尝试在插件配置中添加编码:
project.build.sourceEncoding
属性,并尝试将源文件解析为UTF-8。我尝试在插件配置中添加编码:
<plugin>
<groupId>net.alchim31.maven</groupId>
<artifactId>scala-maven-plugin</artifactId>
<version>3.1.6</version>
<executions>
<execution>
<id>scala-compile-first</id>
<phase>process-resources</phase>
<goals>
<goal>add-source</goal>
<goal>compile</goal>
</goals>
</execution>
<execution>
<id>scala-test-compile</id>
<phase>process-test-resources</phase>
<goals>
<goal>testCompile</goal>
</goals>
</execution>
</executions>
<configuration>
<encoding>Cp1252</encoding>
</configuration>
</plugin>
当这个方法不起作用时,我尝试将编码添加到执行中:
<plugin>
<groupId>net.alchim31.maven</groupId>
<artifactId>scala-maven-plugin</artifactId>
<version>3.1.6</version>
<executions>
<execution>
<id>scala-compile-first</id>
<phase>process-resources</phase>
<goals>
<goal>add-source</goal>
<goal>compile</goal>
</goals>
<configuration>
<sourceDir>${basedir}/scala</sourceDir>
<encoding>Cp1252</encoding>
</configuration>
</execution>
<execution>
<id>scala-test-compile</id>
<phase>process-test-resources</phase>
<goals>
<goal>testCompile</goal>
</goals>
<configuration>
<sourceDir>${basedir}/scala</sourceDir>
<encoding>Cp1252</encoding>
</configuration>
</execution>
</executions>
<configuration>
<encoding>Cp1252</encoding>
</configuration>
</plugin>
这个模块有1454个源文件,所以将该模块转换为使用UTF-8不是实际可行的。