0

I have a maven dependency on jar which contains French characters in a static block of a class.

Now while making the call to this class I get NoClassDefFoundError. After importing the code in eclipse i found that French characters are creating compilation issues thats why my class is not getting loaded.

Is there any way to specify character encoding support in Maven for the dependent jar?

I have already tried -Dfile.encoding=UTF-8 option, but it didn't work.

Aritz
  • 30,971
  • 16
  • 136
  • 217
Pankaj Dwivedi
  • 159
  • 2
  • 13

1 Answers1

1

Do you have the m2e plugin installed into eclipse? If yes, then set this properties into your pom file:

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

Finally right click the project and do Maven->Update Project, that should tell Eclipse you want to use UTF-8 encoding for your project.

Community
  • 1
  • 1
Aritz
  • 30,971
  • 16
  • 136
  • 217
  • I tried this but still facing this issue. One thing to be mentioned here is, the jar is built in Java 1.5 environment and maven project which uses it is in Java 1.6 environment. Can this be an issue? Because the jar is already built then why it should give compilation issue as dependency? – Pankaj Dwivedi Mar 14 '13 at 09:28
  • Use also Maven [compiler plugin](http://maven.apache.org/plugins/maven-compiler-plugin/examples/set-compiler-source-and-target.html) to specify your java version. After update project configuration as said above. – Aritz Mar 14 '13 at 09:43