ICode9

精准搜索请尝试: 精确搜索
首页 > 编程语言> 文章详细

Jasper报告错误:找不到编译器类:org.codehaus.mojo.jasperreports.MavenJavacCompiler

2019-07-06 16:03:29  阅读:231  来源: 互联网

标签:java maven itext jasper-reports


我正在开发一个遗留应用程序,它使用旧版本的jasper报告.现在从7月开始,构建失败了,因为jasper报告版本2.0.5依赖于itext版本[1.02b,而且反过来指向版本4.2.2,而maven存储库中不存在该版本.更多细节在下面的链接中给出

Dependency error in jasper-reports from itext

在按照答案后,我将jasperreports版本更新为3.5.3

<dependency>
    <groupId>jasperreports</groupId>
    <artifactId>jasperreports</artifactId>
    <version>3.5.3</version>
</dependency>

并尝试过

<dependencies>
<dependency>
        <groupId>jasperreports</groupId>
        <artifactId>jasperreports</artifactId>
        <version>2.0.1</version>
        <exclusions>
            <exclusion>
                <groupId>com.lowagie</groupId>
                <artifactId>itext</artifactId>
            </exclusion>
        </exclusions>           
</dependency>
<dependency>
    <groupId>com.lowagie</groupId>
    <artifactId>itext</artifactId>
    <version>2.1.7</version>
    <scope>compile</scope>
</dependency>

在这两种情况下,构建都是成功的,但是当部署应用程序时,在我尝试生成报告的运行时期间,我收到错误

net.sf.jasperreports.engine.JRException: Report compiler class not
found : org.codehaus.mojo.jasperreports.MavenJavacCompiler

我无法弄清楚导致问题的原因.服务器上的JRE版本是1.5,我尝试在1.5和1.6中构建应用程序,它在两个帐户上都失败了.

请帮忙.

谢谢,
Tatha

解决方法:

大家好

我不知道如何编辑来自@Tatha的问题,所以我会在这里发布我的依赖树作为答案.我在理解所有与maven相关的东西时遇到了很大的问题.我刚刚接受了一个旧项目.我尝试使用maven构建并获得与Tatha之前相同的问题/ JRException.

所以这是项目的pom.xml,我无法构建:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <parent>
        <groupId>de.xyz</groupId>
        <artifactId>de.xyz.abc</artifactId>
        <version>2.2.13-RC46-SNAPSHOT</version>
    </parent>

    <artifactId>de.xyz.abc.batch</artifactId>
    <name>abc Batch</name>
    <description>Batch Laufzeitumgebung Imports Exports usw.</description>


    <properties>
        <springbatch.version>2.2.7.RELEASE</springbatch.version>
    </properties>

    <dependencies>

        <dependency>
            <groupId>de.xyz</groupId>
            <artifactId>de.xyz.abc.common</artifactId>
            <version>${project.version}</version>
        </dependency>

        <dependency>
            <groupId>de.xyz</groupId>
            <artifactId>de.xyz.abc.dbsetup</artifactId>
            <version>${project.version}</version>
            <scope>provided</scope>
            <classifier>jar-with-dependencies</classifier>
        </dependency>

        <dependency>
            <groupId>org.springframework.batch</groupId>
            <artifactId>spring-batch-core</artifactId>
            <version>${springbatch.version}</version>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-jdbc</artifactId>
            <version>${org.springframework.version}</version>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context</artifactId>
            <version>${org.springframework.version}</version>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context-support</artifactId>
            <version>${org.springframework.version}</version>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-tx</artifactId>
            <version>${org.springframework.version}</version>
        </dependency>


        <dependency>
            <groupId>org.jasypt</groupId>
            <artifactId>jasypt-spring31</artifactId>
            <version>1.9.0</version>
        </dependency>

        <dependency>
            <groupId>oracle</groupId>
            <artifactId>oracle-jdbc</artifactId>
        </dependency>

        <dependency>
            <groupId>net.sf.saxon</groupId>
            <artifactId>saxon</artifactId>
            <version>8.7</version>
        </dependency>

        <dependency>
            <groupId>org.beanio</groupId>
            <artifactId>beanio</artifactId>
            <version>2.1.0</version>
        </dependency>

        <!-- For testing -->

        <dependency>
            <groupId>org.springframework.batch</groupId>
            <artifactId>spring-batch-test</artifactId>
            <version>${springbatch.version}</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.hsqldb</groupId>
            <artifactId>hsqldb</artifactId>
            <version>2.3.2</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.dbunit</groupId>
            <artifactId>dbunit</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>net.sf.jasperreports</groupId>
            <artifactId>jasperreports</artifactId>
            <version>${jasperreports.version}</version>
        </dependency>

        <dependency>
            <groupId>commons-digester</groupId>
            <artifactId>commons-digester</artifactId>
            <version>1.7</version>
        </dependency>

        <dependency>
            <groupId>commons-cli</groupId>
            <artifactId>commons-cli</artifactId>
            <version>1.2</version>
        </dependency>

    </dependencies>

    <profiles>
        <profile>
            <id>default</id>

            <activation>
                <activeByDefault>true</activeByDefault>
            </activation>

            <properties>
                <configfile>${project.basedir}/../abc.server/src/main/config/developerbuild.properties</configfile>
            </properties>

        </profile>

        <profile>
            <id>jenkins</id>

            <properties>
                <configfile>${project.basedir}/../abc.server/src/main/config/build.properties</configfile>
            </properties>

        </profile>
    </profiles>


    <build>

        <filters>
            <filter>${configfile}</filter>
        </filters>

        <resources>
            <resource>
                <directory>${project.basedir}/src/main/resources</directory>
                <filtering>true</filtering>
            </resource>
            <resource>
                <directory>${project.basedir}/src/test/resources</directory>
                <filtering>true</filtering>
            </resource>
        </resources>

        <plugins>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <version>2.4</version>
                <configuration>
                    <excludes>
                        <exclude>**/*.properties</exclude>
                        <exclude>**/test*Context.xml</exclude>
                        <exclude>**/*.script</exclude>
                    </excludes>
                </configuration>
            </plugin>

            <!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
            <!-- maven-assembly-plugin -->
            <!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
            <plugin>
                <artifactId>maven-assembly-plugin</artifactId>
                <version>2.5.3</version>
                <configuration>
                    <appendAssemblyId>false</appendAssemblyId>
                    <descriptors>
                        <descriptor>src/main/assembly/assembly.xml</descriptor>
                    </descriptors>
                </configuration>
                <executions>
                    <execution>
                        <id>make-assembly</id>
                        <phase>package</phase>
                        <goals>
                            <goal>single</goal>
                        </goals>
                        <inherited>false</inherited>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>properties-maven-plugin</artifactId>
                <version>1.0-alpha-2</version>
                <executions>
                    <execution>
                        <phase>initialize</phase>
                        <goals>
                            <goal>read-project-properties</goal>
                        </goals>
                        <configuration>
                            <files>
                                <file>${configfile}</file>
                            </files>
                            <quiet>false</quiet>
                            <detail>true</detail>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

            <!-- <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-dependency-plugin</artifactId> 
                <version>2.4</version> <executions> <execution> <id>Unpack db-script cleanUser</id> 
                <phase>process-test-resources</phase> <goals> <goal>unpack</goal> </goals> 
                <configuration> <artifactItems> <artifactItem> <groupId>de.xyz</groupId> 
                <artifactId>de.xyz.abc.dbsetup</artifactId> <version>${project.version}</version> 
                </artifactItem> </artifactItems> <includes>**/*/cleanUser.sql</includes> 
                <outputDirectory>${project.build.directory}</outputDirectory> </configuration> 
                </execution> </executions> </plugin> <plugin> <groupId>org.codehaus.mojo</groupId> 
                <artifactId>sql-maven-plugin</artifactId> <executions> <execution> <id>Clean 
                DB-User/-Schema before tests</id> <configuration> Für die Tests benutzen 
                wir $db.test.user und $db.test.pass, deswegen hier überschrieben <username>${db.test.user}</username> 
                <password>${db.test.pass}</password> </configuration> </execution> </executions> 
                </plugin> <plugin> <groupId>org.liquibase</groupId> <artifactId>liquibase-maven-plugin</artifactId> 
                <executions> <execution> <id>Create or update DB-Schema before tests</id> 
                <configuration> Für die Tests benutzen wir $db.test.user und $db.test.pass, 
                deswegen hier überschrieben <username>${db.test.user}</username> <password>${db.test.pass}</password> 
                </configuration> </execution> </executions> </plugin> -->

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-resources-plugin</artifactId>
                <version>2.5</version>
                <executions>
                    <execution>
                        <id>default-compile</id>
                        <phase>process-resources</phase>
                        <goals>
                            <goal>copy-resources</goal>
                        </goals>
                        <inherited>false</inherited>
                        <configuration>
                            <resources>
                                <resource>
                                    <directory>${basedir}/src/main/resources</directory>
                                    <includes>
                                        <include>batch.properties</include>
                                        <include>logback.xml</include>
                                    </includes>
                                    <filtering>true</filtering>
                                </resource>
                            </resources>
                            <filters>
                                <filter>${configfile}</filter>
                            </filters>
                            <overwrite>true</overwrite>
                            <outputDirectory>${project.build.directory}/config</outputDirectory>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.jacoco</groupId>
                <artifactId>jacoco-maven-plugin</artifactId>
                <version>0.7.4.201502262128</version>
                <configuration>
                    <skip>true</skip>
                </configuration>
            </plugin>

            <plugin>
                <groupId>de.xyz.legacy</groupId>
                <artifactId>jasperreports-maven-plugin</artifactId>
                <version>1.0.3</version>

                <executions>
                    <execution>
                        <goals>
                            <goal>compile-reports</goal>
                        </goals>
                    </execution>
                </executions>

                <dependencies>
                    <!--note this must be repeated here to pick up correct xml validation -->
                    <dependency>
                        <groupId>net.sf.jasperreports</groupId>
                        <artifactId>jasperreports</artifactId>
                        <version>${jasperreports.version}</version>
                    </dependency>
                    <dependency>
                        <groupId>org.springframework</groupId>
                        <artifactId>spring-aop</artifactId>
                        <version>${org.springframework.version}</version>
                    </dependency>
                    <dependency>
                        <groupId>commons-collections</groupId>
                        <artifactId>commons-collections</artifactId>
                        <version>3.2.2</version>
                    </dependency>
                </dependencies>

            </plugin>

        </plugins>

        <pluginManagement>
            <plugins>
                <!--This plugin's configuration is used to store Eclipse m2e settings 
                    only. It has no influence on the Maven build itself. -->
                <plugin>
                    <groupId>org.eclipse.m2e</groupId>
                    <artifactId>lifecycle-mapping</artifactId>
                    <version>1.0.0</version>
                    <configuration>
                        <lifecycleMappingMetadata>
                            <pluginExecutions>
                                <pluginExecution>
                                    <pluginExecutionFilter>
                                        <groupId>org.apache.maven.plugins</groupId>
                                        <artifactId>maven-dependency-plugin</artifactId>
                                        <versionRange>[2.4,)</versionRange>
                                        <goals>
                                            <goal>unpack-dependencies</goal>
                                        </goals>
                                    </pluginExecutionFilter>
                                    <action>
                                        <ignore />
                                    </action>
                                </pluginExecution>
                                <pluginExecution>
                                    <pluginExecutionFilter>
                                        <groupId>org.liquibase</groupId>
                                        <artifactId>liquibase-maven-plugin</artifactId>
                                        <versionRange>[2.0.5,)</versionRange>
                                        <goals>
                                            <goal>dropAll</goal>
                                        </goals>
                                    </pluginExecutionFilter>
                                    <action>
                                        <ignore />
                                    </action>
                                </pluginExecution>
                                <pluginExecution>
                                    <pluginExecutionFilter>
                                        <groupId>org.codehaus.mojo</groupId>
                                        <artifactId>jasperreports-maven-plugin</artifactId>
                                        <versionRange>
                                            [0,)
                                        </versionRange>
                                        <goals>
                                            <goal>compile-reports</goal>
                                        </goals>
                                    </pluginExecutionFilter>
                                    <action>
                                        <ignore />
                                    </action>
                                </pluginExecution>
                                <pluginExecution>
                                    <pluginExecutionFilter>
                                        <groupId>
                                            de.xyz.legacy
                                        </groupId>
                                        <artifactId>
                                            jasperreports-maven-plugin
                                        </artifactId>
                                        <versionRange>
                                            [1.0.3,)
                                        </versionRange>
                                        <goals>
                                            <goal>compile-reports</goal>
                                        </goals>
                                    </pluginExecutionFilter>
                                    <action>
                                        <ignore />
                                    </action>
                                </pluginExecution>
                            </pluginExecutions>
                        </lifecycleMappingMetadata>
                    </configuration>
                </plugin>
            </plugins>
        </pluginManagement>
    </build>

</project>

这是mvn dependency:tree的输出

[INFO] de.kvwl:de.kvwl.kaev.batch:jar:2.2.13-RC46-SNAPSHOT
[INFO] +- de.kvwl:de.kvwl.kaev.common:jar:2.2.13-RC46-SNAPSHOT:compile
[INFO] +- de.kvwl:de.kvwl.kaev.dbsetup:jar:jar-with-dependencies:2.2.13-RC46-SNA                                                                                                              PSHOT:provided
[INFO] |  +- org.liquibase:liquibase-core:jar:3.0.6:provided
[INFO] |  |  \- org.yaml:snakeyaml:jar:1.13:provided
[INFO] |  +- postgresql:postgresql:jar:9.0-801.jdbc4:provided
[INFO] |  \- mysql:mysql-connector-java:jar:5.1.33:provided
[INFO] +- org.springframework.batch:spring-batch-core:jar:2.2.7.RELEASE:compile
[INFO] |  +- org.springframework.batch:spring-batch-infrastructure:jar:2.2.7.REL                                                                                                              EASE:compile
[INFO] |  |  \- org.springframework.retry:spring-retry:jar:1.0.2.RELEASE:compile
[INFO] |  +- com.thoughtworks.xstream:xstream:jar:1.3:compile
[INFO] |  |  \- xpp3:xpp3_min:jar:1.1.4c:compile
[INFO] |  +- org.codehaus.jettison:jettison:jar:1.1:compile
[INFO] |  \- org.springframework:spring-beans:jar:3.2.9.RELEASE:compile
[INFO] +- org.springframework:spring-jdbc:jar:4.2.3.RELEASE:compile
[INFO] +- org.springframework:spring-context:jar:4.2.3.RELEASE:compile
[INFO] |  \- org.springframework:spring-expression:jar:4.2.3.RELEASE:compile
[INFO] +- org.springframework:spring-context-support:jar:4.2.3.RELEASE:compile
[INFO] +- org.springframework:spring-tx:jar:4.2.3.RELEASE:compile
[INFO] +- org.jasypt:jasypt-spring31:jar:1.9.0:compile
[INFO] |  \- org.jasypt:jasypt:jar:1.9.0:compile
[INFO] +- oracle:oracle-jdbc:jar:12.1.0.2:compile
[INFO] +- net.sf.saxon:saxon:jar:8.7:compile
[INFO] +- org.beanio:beanio:jar:2.1.0:compile
[INFO] +- org.springframework.batch:spring-batch-test:jar:2.2.7.RELEASE:test
[INFO] |  +- org.springframework:spring-test:jar:3.2.9.RELEASE:test
[INFO] |  +- commons-io:commons-io:jar:1.4:test
[INFO] |  \- commons-dbcp:commons-dbcp:jar:1.2.2:test
[INFO] |     \- commons-pool:commons-pool:jar:1.3:test
[INFO] +- org.hsqldb:hsqldb:jar:2.3.2:test
[INFO] +- org.dbunit:dbunit:jar:2.4.9:test
[INFO] |  \- org.slf4j:slf4j-api:jar:1.7.7:compile
[INFO] +- net.sf.jasperreports:jasperreports:jar:4.8.0:compile
[INFO] |  +- commons-logging:commons-logging:jar:1.1.1:compile
[INFO] |  +- com.lowagie:itext:jar:2.1.7.js1:compile
[INFO] |  |  +- bouncycastle:bcmail-jdk14:jar:138:compile
[INFO] |  |  +- bouncycastle:bcprov-jdk14:jar:138:compile
[INFO] |  |  \- org.bouncycastle:bctsp-jdk14:jar:1.38:compile
[INFO] |  |     +- org.bouncycastle:bcprov-jdk14:jar:1.38:compile
[INFO] |  |     \- org.bouncycastle:bcmail-jdk14:jar:1.38:compile
[INFO] |  +- jfree:jcommon:jar:1.0.15:compile
[INFO] |  +- jfree:jfreechart:jar:1.0.12:compile
[INFO] |  +- xml-apis:xml-apis:jar:1.3.02:compile
[INFO] |  +- eclipse:jdtcore:jar:3.1.0:compile
[INFO] |  +- org.codehaus.castor:castor:jar:1.2:compile
[INFO] |  +- org.apache.poi:poi-ooxml:jar:3.7:compile
[INFO] |  |  +- org.apache.poi:poi:jar:3.7:compile
[INFO] |  |  +- org.apache.poi:poi-ooxml-schemas:jar:3.7:compile
[INFO] |  |  |  +- org.apache.xmlbeans:xmlbeans:jar:2.3.0:compile
[INFO] |  |  |  |  \- stax:stax-api:jar:1.0.1:compile
[INFO] |  |  |  \- org.apache.geronimo.specs:geronimo-stax-api_1.0_spec:jar:1.0:                                                                                                              compile
[INFO] |  |  \- dom4j:dom4j:jar:1.6.1:compile
[INFO] |  +- com.fasterxml.jackson.core:jackson-core:jar:2.0.5:compile
[INFO] |  +- com.fasterxml.jackson.core:jackson-databind:jar:2.0.5:compile
[INFO] |  \- com.fasterxml.jackson.core:jackson-annotations:jar:2.0.5:compile
[INFO] +- commons-digester:commons-digester:jar:1.7:compile
[INFO] +- commons-cli:commons-cli:jar:1.2:compile
[INFO] +- ch.qos.logback:logback-classic:jar:1.1.3:compile
[INFO] +- ch.qos.logback:logback-core:jar:1.1.3:compile
[INFO] +- org.slf4j:jcl-over-slf4j:jar:1.7.12:compile
[INFO] +- org.slf4j:log4j-over-slf4j:jar:1.7.12:compile
[INFO] +- de.kvwl:de.kvwl.common.base:jar:2.7.3:compile
[INFO] +- commons-lang:commons-lang:jar:2.5:compile
[INFO] +- commons-collections:commons-collections:jar:3.2.1:compile
[INFO] +- commons-beanutils:commons-beanutils:jar:1.8.3:compile
[INFO] +- commons-codec:commons-codec:jar:1.3:compile
[INFO] +- org.quartz-scheduler:quartz:jar:2.2.1:compile
[INFO] |  \- c3p0:c3p0:jar:0.9.1.1:compile
[INFO] +- com.prowidesoftware:pw-swift-core:jar:SRU2014-7.6:compile
[INFO] |  \- rhino:js:jar:1.7R2:runtime
[INFO] +- org.springframework:spring-core:jar:4.2.3.RELEASE:compile
[INFO] +- org.springframework:spring-aop:jar:4.2.3.RELEASE:compile
[INFO] |  \- aopalliance:aopalliance:jar:1.0:compile
[INFO] +- org.springframework:spring-web:jar:4.2.3.RELEASE:compile
[INFO] +- org.springframework:spring-webmvc:jar:4.2.3.RELEASE:compile
[INFO] +- net.objectlab.kit:datecalc-common:jar:1.3.0:compile
[INFO] +- net.objectlab.kit:datecalc-joda:jar:1.3.0:compile
[INFO] +- ar.com.fdvs:DynamicJasper-core-fonts:jar:1.0:compile
[INFO] +- com.google.guava:guava:jar:18.0:compile
[INFO] +- javax.xml.bind:jaxb-api:jar:2.2.7:compile
[INFO] +- joda-time:joda-time:jar:1.6:compile
[INFO] +- de.jollyday:jollyday:jar:0.4.7:compile
[INFO] +- xerces:xercesImpl:jar:2.9.0:compile
[INFO] \- junit:junit:jar:4.11:test
[INFO]    \- org.hamcrest:hamcrest-core:jar:1.3:test

标签:java,maven,itext,jasper-reports
来源: https://codeday.me/bug/20190706/1398605.html

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有