Spring roo project中 异常:
Multiple markers at this line
- The local variable a is never read
- String literal is not properly closed by a double-
quote

Spring Roo 目前还不直接支持UTF8,只支持西欧字体,用native2ascii转,可以使用maven的plugin了。
下面是配置例子:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<id>compile</id>
<phase>compile</phase>
<configuration>
<tasks>
<native2ascii
encoding="UTF-8"
src="src/main/webapp/WEB-INF/i18n"
dest="target/${name}-${version}/WEB-INF/i18n"
includes="*_zh.properties"/>
</tasks>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>ant</groupId>
<artifactId>ant-nodeps</artifactId>
<version>1.6.5</version>
</dependency>
<dependency>
<groupId>com.sun</groupId>
<artifactId>tools</artifactId>
<version>1.5.0</version>
<scope>system</scope>
<systemPath>${java.home}/../lib/tools.jar</systemPath>
</dependency>
</dependencies>
</plugin>
例如:spring roo project中 :
String hello = "你";
当遇到奇数个汉字的声明的时候会报错误。
处理方法如上!
本文介绍了解决SpringRoo项目中UTF-8编码问题的方法。通过使用Maven插件进行native2ascii转换,可以有效处理中文字符导致的编译错误。文中提供了一个具体的配置示例。

被折叠的 条评论
为什么被折叠?



