在JaspersReports的fonts.xml中找不到输入流

时间:2017-08-10 07:28:41

标签: maven jasper-reports

我已经有两天时间来解决这个问题并且没有成功。这个例外被抛出

Caused by: net.sf.jasperreports.engine.JRRuntimeException: net.sf.jasperreports.engine.JRException: Input stream not found at : fonts.xml
        at net.sf.jasperreports.engine.fonts.SimpleFontExtensionHelper.loadFontFamilies(SimpleFontExtensionHelper.java:188)
at net.sf.jasperreports.engine.fonts.SimpleFontExtensionHelper.loadFontFamilies(SimpleFontExtensionHelper.java:188)

我将java 8与Maven builder

一起使用

这是我的pom.xml配置

<dependency>
    <groupId>net.sf.jasperreports</groupId>
    <artifactId>jasperreports</artifactId>
    <version>6.0.0</version>
</dependency>
<dependency>
    <groupId>net.sf.jasperreports</groupId>
    <artifactId>jasperreports-fonts</artifactId>
    <version>6.0.0</version>
</dependency>

这是一个jasperreports_extension.properties配置,在使用位于根路径的maven打包后

net.sf.jasperreports.extension.registry.factory.system.font.families=net.sf.dynamicreports.jasper.base.JasperSystemFontExtensionsRegistryFactor
net.sf.jasperreports.extension.system.font.families.drfonts=fonts.xml

这是我的fonts.xml

   

<fontFamily name="SansSerif">
    <exportFonts>
        <export key="net.sf.jasperreports.html">Arial, Helvetica, sans-serif</export>
        <export key="net.sf.jasperreports.xhtml">Arial, Helvetica, sans-serif</export>
    </exportFonts>
</fontFamily>

<fontFamily name="Serif">
    <exportFonts>
        <export key="net.sf.jasperreports.html">'Times New Roman', Times, serif</export>
        <export key="net.sf.jasperreports.xhtml">'Times New Roman', Times, serif</export>
    </exportFonts>
</fontFamily>

<fontFamily name="Monospaced">
    <exportFonts>
        <export key="net.sf.jasperreports.html">'Courier New', Courier, monospace</export>
        <export key="net.sf.jasperreports.xhtml">'Courier New', Courier, monospace</export>
    </exportFonts>
</fontFamily>

当我在eclipse中执行此操作时,可以正常工作并创建PDF。

当我通过maven构建并尝试从cmd执行时,我得到了这个例外。

我还尝试在net.sf.jasperreports.fonts中添加另一个customfont.xml,并尝试将net.sf.jasperreports.extension.system.font.families.drfonts = fonts.xml添加到

net.sf.jasperreports.extension.system.font.families.drfonts = net / sf / jasperreports / fonts但没有任何作品......

0 个答案:

没有答案