Rajmahendra
Rajmahendra

Reputation: 3224

Sonar throws error when encounter unicode in java

i am trying to run sonar on our java code using a minimum maven pom.

I can run 3 project

When i encounter a project having unicode UTF-8 the sonar:sonar command fails!

INFO]  Sensor SquidSensor...
INFO]  Java AST scan...
INFO] ------------------------------------------------------------------------
ERROR] BUILD ERROR
INFO] ------------------------------------------------------------------------
INFO] Can not execute Sonar

mbedded error: Got an exception - unexpected char: '\', file : D:\Sonar\Projects\AoGServices\src\main\com\mypackage\ao565svc\services\KommunikationPrµferenceOpretServiceBean.java, line : 34
INFO] ------------------------------------------------------------------------

the line 34 having a class name with "\u00E6"

How can i tell sonar to work on the unicode ?

Upvotes: 1

Views: 650

Answers (1)

Stephen C
Stephen C

Reputation: 718926

I haven't tried this, but I think you may be able to fix this by adding the following to your POM:

<project>
  ...
  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    ...
  </properties>
  ...
</project>

References:

Upvotes: 1

Related Questions