grails - Grails 3.x 中的 Jasper

标签 grails jasper-reports pdf-generation

使用Grails 3.0.12,我需要生成 PDF 报告,最好使用 JasperReports,但尚未找到可用的插件。

我使用了 Grails 文档中的编译“org.grails.plugins:jasper:1.11.0”,但没有成功。

我应该使用什么插件?或者是否有其他方法可以在 Grails 3.x 中生成 PDF 报告?

最佳答案

我正在使用 Grails 3.2.4,经过一番谷歌搜索并搜索如何在 Grails 3.X 版本上安装 Jasper Reports 而不会出现编译错误,请参阅官方 Grails Plugin Page for version 3.Xgrails-jasper插件,问题是您必须使用源代码创建插件存档,并使用在 grails 项目中创建的插件,如文档中所述。我使用的另一种解决方案是使用 grails-jasper 插件代码中相同的插件依赖项,此代码位于文件 build.gradle 中。插件源代码,您只需要使用必要的依赖项,以下是我使用的所有内容,并且运行良好。

dependencies {
    ...
    compile('com.lowagie:itext:2.1.7')

    compile('net.sf.jasperreports:jasperreports:5.6.1') {
        exclude module: 'antlr'
        exclude module: 'commons-logging'
        exclude module: 'ant'
        exclude module: 'mondrian'
        exclude module: 'commons-javaflow'
        exclude module: 'barbecue'
        exclude module: 'xml-apis-ext'
        exclude module: 'xml-apis'
        exclude module: 'xalan'
        exclude module: 'groovy-all'
        exclude module: 'hibernate'
        exclude module: 'saaj-api'
        exclude module: 'servlet-api'
        exclude module: 'xercesImpl'
        exclude module: 'xmlParserAPIs'
        exclude module: 'spring-core'
        exclude module: 'bsh'
        exclude module: 'spring-beans'
        exclude module: 'jaxen'
        exclude module: 'barcode4j'
        exclude module: 'batik-svg-dom'
        exclude module: 'batik-xml'
        exclude module: 'batik-awt-util'
        exclude module: 'batik-dom'
        exclude module: 'batik-css'
        exclude module: 'batik-gvt'
        exclude module: 'batik-script'
        exclude module: 'batik-svggen'
        exclude module: 'batik-util'
        exclude module: 'batik-bridge'
        exclude module: 'persistence-api'
        exclude module: 'jdtcore'
        exclude module: 'bcmail-jdk16'
        exclude module: 'bcprov-jdk16'
        exclude module: 'bctsp-jdk16'
        exclude module: 'bcmail-jdk14'
        exclude module: 'bcprov-jdk14'
        exclude module: 'bctsp-jdk14'
        exclude module: 'xmlbeans'
        exclude module: 'olap4j'
    }

    compile('org.apache.poi:poi:3.10-FINAL')
    ...
} 

我希望它适用于您的项目。

关于grails - Grails 3.x 中的 Jasper,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36731400/

相关文章:

apache - 启动部署架构-在没有Apache的情况下运行Glassfish V3前奏

java - 如何在空的 iReport 中将 TableModel 设置为 DataSource (NetBeans 7.1)

javascript - 错误 mPDF 需要 mb_string 函数

java - 我如何/可以使用 base64 作为 Jasper 报告模板中的图像源?

jsp - JasperReport 查看器 JSP WebApp 错误

c# - 当从 HTML 或 URL 生成大型 pdf 时,Websupergoo abcpdf 非常慢

html - 在 chrome 中自动打印/将网页保存为 pdf - python 2.7

ajax - AngularJS和Spring Security取消了AJAX请求

tomcat - Grails 和 Tomcat : Where to store uploaded files in filesystem?

mysql - Grails 数据库迁移插件 - sql 与 'bundled changes'