Showing posts with label Maven. Show all posts
Showing posts with label Maven. Show all posts

Wednesday, September 29, 2010

Maven: unmappable character for encoding UTF8

If maven keeps complaining about "unmappable character for encoding UTF8" you are most probably having some special characters within your source code like ä or á. Since your editor is not using UTF-8 as file encoding - like eclipse does not in default settings under windows (it uses platform-specific encoding Cp1252) - this will cause problems with the maven-compiler-plugin.

For quick-fixing this problem you might want to add the following to your pom.xml:

Set the encoding to whatever your source files are using. Anyway I would recommend to remove all the characters causing those problems and also change the default encoding to UTF-8 to be consistent with the maven defaults and not having to set this explicitly.

Generally not using special characters in source code should prevent those problems completely that might occur quickly again introduced by developers who for any reason do not use UTF-8 as default encoding again and the trouble will start anew.

Thursday, May 27, 2010

Deploy Maven Artifact As Zip Package Only

I was trying to package a maven artifact as a zip archive lately and found out that it's not as easy as it seems because zip is no native packaging to maven.

I finally found a solution using the maven-assembly-plugin. You have to choose "pom" as packaging because maven would otherwise (try to) build a jar archive which you don't want here. Furthermore you have to set the assembly-plugins configuration key "appendAssemblyId" to false so that the resulting zip package has no classifier you would have to specifiy when using it as dependency later on. Thats my resulting pom.xml:

And thats the assembly descriptor:

There is an easier solution? Damn it and let me know!

Thanks for following

freak