【问题标题】:Generate .jasper with maven plugin使用 maven 插件生成 .jasper
【发布时间】:2016-08-31 01:33:03
【问题描述】:

我希望提高我的应用程序的性能,它有两种类型的报告,然后在执行时像这样编译:

  final JasperDesign design = JRXmlLoader.load(input);

  final JasperReport compiledReport = JasperCompileManager.compileReport(design);

每当用户想要在应用程序上查看报告时,都会执行此代码。 为了避免这种情况,我试图通过 maven jasperreports 插件执行 .jrxml 的编译,但它不起作用,并且控制台上没有错误。 .jasper 文件没有出现在我的目录“outputDirectory”中。

        <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>jasperreports-maven-plugin</artifactId>
        <executions>
         <execution>
              <phase>compile</phase>
            <inherited>false</inherited>
            <goals>
                <goal>compile-reports</goal>
            </goals>
         </execution>
        </executions>
        <configuration>
         <sourceDirectory>src/main/resources/reports</sourceDirectory>
        <outputDirectory>src/main/resources/reports/jasper</outputDirectory>
            <compiler>net.sf.jasperreports.engine.design.JRJdtCompiler</compiler>
        </configuration>
    </plugin>

【问题讨论】:

  • 感谢 Deendayal。我关注此页面,添加依赖项和排除项。我的应用程序启动了,但文件夹“jasper”仍然是空的......我没有找到问题......
  • 您在构建日志中没有收到任何错误?
  • 不,任何错误..启动是正确的。
  • 考虑迁移到jasperreports-pluginstackoverflow.com/q/18495377/1743880

标签: java maven jasper-reports maven-plugin


【解决方案1】:

我知道这是旧的,但是当我在 POM 的 &lt;pluginManagement&gt; 部分而不是 &lt;plugins&gt; 中定义插件时,这发生在我身上。

【讨论】:

    【解决方案2】:

    这是我使用的 pom 配置

    <build>
        <plugins>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>jasperreports-maven-plugin</artifactId>
                <version>1.0-beta-2</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>compile-reports</goal>
                        </goals>
                        <configuration>
                            <!--  jrxml file  directory-->
                            <sourceDirectory>src\\main\\resources\\reports\\template</sourceDirectory>
                            <sourceFileExt>.jrxml</sourceFileExt>
                            <compiler>net.sf.jasperreports.engine.design.JRJavacCompiler</compiler>
                            <!--  Destination for jasper file -->
                            <outputDirectory>src\\main\\resources\\reports\\jasper</outputDirectory>
                        </configuration>
                    </execution>
                </executions>
                <dependencies>
                    <!-- These plugins are used to specify correct version for jrxml xml validation -->
                    <dependency>
                        <groupId>net.sf.jasperreports</groupId>
                        <artifactId>jasperreports</artifactId>
                        <version>4.5.0</version>
                    </dependency>
    
                    <dependency>
                        <groupId>log4j</groupId>
                        <artifactId>log4j</artifactId>
                        <version>1.2.16</version>
                    </dependency>
    
                </dependencies>
            </plugin>
    
        </plugins>
    </build>
    

    【讨论】:

      猜你喜欢
      • 2017-10-04
      • 2014-12-05
      • 2014-12-01
      • 2011-08-20
      • 1970-01-01
      • 2014-07-27
      • 1970-01-01
      • 2019-06-19
      • 2012-04-09
      相关资源
      最近更新 更多