问题描述
当使用jasperreports-maven-plugin / 1.0-beta-2将jrxml文件编译为jasper时,生成的报告不能正确显示unicode字符,它会显示????相反。
When using the jasperreports-maven-plugin/1.0-beta-2 to compile a jrxml file to jasper, the resulting report doesn't display unicode characters properly, it displays ???? instead.
很明显这是一个字体问题。所以我打开了iReport 4.0.1,并从那里编译了jrxml文件而没有改变任何特定的设置,生成的jasper文件可以很好地显示unicode字符。所以我假设有一些编译时属性我没有正确设置。
It is obvious this is a font problem. So I opened iReport 4.0.1, and compiled the jrxml file from there without changing any specific settings, the resulting jasper file could display the unicode characters just fine. So I am assuming there are some compile time properties which I am not setting properly.
我想使用jasperreports-maven-plugin插件的标签来定义生成编译jasper文件时使用的编码属性。但是我无法找到那里设置的属性。
I thought of using the tag of the jasperreports-maven-plugin plugin, to define the resulting encoding properties to the used when compiling the jasper file. But I couldnt find what properties to set there.
我猜测了一些属性来自
具体
net.sf.jasperreports.default.pdf.encoding
net.sf.jasperreports.export.character.encoding
但无济于事。
所以我想知道iReport是否使用了一些关于可以在asperreports-maven-plugin mojo中设置的字体,编码或字符集属性的特殊编译选项。
So I would like to know either if iReport uses some special compilation options regarding fonts,encoding or charset properties that can be set in the asperreports-maven-plugin mojo.
Alernatively,如果这不可能从这个mojo。
Alernatively, if this is not possible from this mojo.
谢谢
推荐答案
Maven插件很可能不使用JasperReports 4.0.1来编译报告。默认情况下,它使用定义为依赖关系的JasperReports:jasperreports:jasperreports:1.2.0。
The Maven plugin is most likely not using JasperReports 4.0.1 to compile the report. By default it uses the JasperReports defined as a dependency: jasperreports:jasperreports:1.2.0.
因为JasperReports 4.0.1有一个不同的组,工件和版本,这个依赖关系可以不被覆盖。排除仅适用于依赖项的依赖项,因此也不是一种选项。你将需要一个不同版本的mojo来使用4.0.1编译模板。
Because JasperReports 4.0.1 has a different group, artifact and version this dependency can't be overridden. Exclusions only work for dependencies of dependencies, so that isn't an option either. You will need a different version of the mojo to compile templates using 4.0.1.
幸运的是你已经将一个补丁应用到了mojo的主干所以你们所有人要做的就是检查代码并将版本部署到您的存储库。
Lucky for you a patch has already been applied to the trunk of the mojo so all you have to do is check out the code and deploy a version to your repository.
部署插件后,您需要将依赖关系覆盖到4.0.1。您可以通过在插件级别定义依赖项来实现此目的。
After deploying the plugin you will need to override the dependency to 4.0.1. You do this by defining dependencies at the plugin level.
< plugin>
< groupId> ; org.codehaus.mojo< / groupId>
< artifactId> jasperreports-maven-plugin< / artifactId>
< dependencies>
<依赖>
< groupId> net.sf.jasperreports< / groupId>
< artifactId> jasperreports< / artifactId>
< version> 4.0 .1< / version>
< / dependency>
< / dependencies>
< / plugin>
这篇关于Maven jasperreports-maven-plugin定义了编译字符集的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!