Maven Native2Ascii plugin
UPDATE: As Carlos Sanchez pointed out, there is now a standard way to execute native2ascii target. Check out the project home page.
Recently, I’ve been updating one of my sites to use Java properties files to ease localization process. Since I moved my project to Maven 2, I’ve never experienced any problem regarding project building. Until now.
Is there no native2ascii plugin in Maven?
When I was using Ant (in another project), I wrote a special target to encode all properties files (written in Polish) to escaped UTF-8 format. It was working like a charm.But when it comes to Maven, no such functionality is built in. After some googling in the Maven Project site, I’ve found a way how to incorporate ant tasks into maven build lifecycle. I’ve also found a very interesting post on John Ferguson Smart’s blog, which actually solves my problem very well.However, I have two objections to that example - it’s redundant, when it comes to implementing such behavior in multiple projects, and it makes pom.xml (Maven 2 project configuration file) a bit messy. So I’ve decided to create a better solution.
Writing my own native2ascii Maven plugin
Maven 2 documentation has a great article about writing Maven plugins as Ant targets and linking them to the Maven project build lifecycle. The whole process is easy and straightforward. Actually, I had my Ant plugin working in few hours. And now it’s working like a charm as well.If you would like to try it, please download the file linked at the end of this post. After unzipping it, go to the maven-ant-plugins directory, and type the following command in the terminal window: ‘mvn -U install’. Maven repository will be updated and the plugin will be installed.After that, you may want to test it. First of all, change the directory to test-project, and type ‘mvn compile’. The ants:native2ascii plugin will be processed automatically with the compilation process.And that’s all! Hope this helps you a bit! Maven Native2Ascii zipped archive
About this entry
You’re currently reading “Maven Native2Ascii plugin,” an entry on Jakub Pawlowicz’s Weblog
- Published:
- 3.19.06 / 6pm
- Category:
- Java
- Tags:
- Maven, native2ascii, plugins
2 Comments
Jump to comment form | comments rss [?] | trackback uri [?]