Fat jar with embedded fonts

Creating fat jars using maven is pretty simple. But it won’t simply work if you’re using jasper reports and embed fonts into your PDF reports. You’ll probably end up with an exception like the following:

Problem

The problem comes from the created jasperreports_extension.properties file. Jasper already comes with one pre-packaged. When now a fat-jar is created, maven will probably drop the jasper packaged one in favour of the one created to embed the fonts.

Solution

The simplest solution is, of course, just copying the contents of the jasperreports_extension.properties files into a single one.

Are more elegant solution would be, getting maven to do this. With doing this, you don’t have to bother merging the files manually with each update of jasper reports.

Example Code

References

5 thoughts on “Fat jar with embedded fonts”

  1. Saved my life, thanks!

    In my case it was even worse, jasper was throwing an exception and while trying to log it it was throwing another one…. so that was real mystery…

  2. Very nice to hear that and you managed to track down the root cause 🙂
    Feel free to post your initial exception. It might help others. 😉

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.