使用错误的临时目录时,JasperReports使用错误的temp目录进行编译,以使用高于4.5的v.1.1来支持java 1.8

时间:2015-10-06 01:27:30

标签: java jasper-reports java-8

我在我的Java应用程序中使用JasperReports库版本4.5.1,我正在尝试升级更高版本以升级到java 1.8。

我正在使用JasperReports ant任务在编译时将* .jrxml文件构建到* .jasper文件中。以下是我们的build.xml文件的相关摘录:

<target name="compile-report" depends="init">
    <taskdef name="jrc" classname="net.sf.jasperreports.ant.JRAntCompileTask" classpath="${javac.classpath}"/>
    <mkdir dir="${build.classes.dir}/usda/weru/weps/reports"/>
    <jrc tempdir="${build.classes.dir}/usda/weru/weps/reports" compiler="usda.weru.weps.reports.compile.JRJavacCompiler" destdir="${build.classes.dir}/usda/weru/weps/reports">
        <src>
            <fileset dir="${basedir}/reports">
                <include name="**/*.jrxml"/>                    
            </fileset>
        </src>
        <classpath path="${run.classpath}"/>
    </jrc>
    <!--copy the styles into the classpath-->
    <copy todir="${build.classes.dir}/usda/weru/weps/reports">
        <fileset dir="${basedir}/reports">
            <include name="**/*.jrtx"/>
        </fileset>            
    </copy>
</target>

我无法理解为什么JasperReports试图在C:\ Program Files \ NetBeans 8.0中保存任何内容?我在ant任务中指定了一个临时目录,为什么不使用该位置?

以下是异常堆栈跟踪的全文:

File : C:\Users\maxerdwien\Documents\Netbeans_src\baseline\weps.gui-max\reports\_harvestsdetail.jrxml ... FAILED.
Error compiling report design : C:\Users\maxerdwien\Documents\Netbeans_src\baseline\weps.gui-max\reports\_harvestsdetail.jrxml
net.sf.jasperreports.engine.JRException: Error saving expressions class file : C:\Program Files\NetBeans 8.0\_harvestsdetail_1417022482708_967062.java
    at net.sf.jasperreports.engine.util.JRSaver.saveClassSource(JRSaver.java:153)
    at net.sf.jasperreports.engine.design.JRAbstractCompiler.getSourceFile(JRAbstractCompiler.java:310)
    at net.sf.jasperreports.engine.design.JRAbstractCompiler.createCompileUnit(JRAbstractCompiler.java:282)
    at net.sf.jasperreports.engine.design.JRAbstractCompiler.compileReport(JRAbstractCompiler.java:177)
    at net.sf.jasperreports.engine.JasperCompileManager.compile(JasperCompileManager.java:240)
    at net.sf.jasperreports.engine.JasperCompileManager.compileReport(JasperCompileManager.java:496)
    at net.sf.jasperreports.engine.JasperCompileManager.compileToFile(JasperCompileManager.java:156)
    at net.sf.jasperreports.engine.JasperCompileManager.compileReportToFile(JasperCompileManager.java:445)
    at net.sf.jasperreports.engine.JasperCompileManager.compileToFile(JasperCompileManager.java:138)
    at net.sf.jasperreports.ant.JRAntCompileTask.compile(JRAntCompileTask.java:402)
    at net.sf.jasperreports.ant.JRAntCompileTask.execute(JRAntCompileTask.java:249)
    at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
    at sun.reflect.GeneratedMethodAccessor222.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
    at org.apache.tools.ant.Task.perform(Task.java:348)
    at org.apache.tools.ant.Target.execute(Target.java:435)
    at org.apache.tools.ant.Target.performTasks(Target.java:456)
    at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1393)
    at org.apache.tools.ant.helper.SingleCheckExecutor.executeTargets(SingleCheckExecutor.java:38)
    at org.apache.tools.ant.Project.executeTargets(Project.java:1248)
    at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:441)
    at org.apache.tools.ant.taskdefs.CallTarget.execute(CallTarget.java:105)
    at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
    at sun.reflect.GeneratedMethodAccessor222.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
    at org.apache.tools.ant.Task.perform(Task.java:348)
    at org.apache.tools.ant.Target.execute(Target.java:435)
    at org.apache.tools.ant.Target.performTasks(Target.java:456)
    at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1393)
    at org.apache.tools.ant.Project.executeTarget(Project.java:1364)
    at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
    at org.apache.tools.ant.Project.executeTargets(Project.java:1248)
    at org.apache.tools.ant.module.bridge.impl.BridgeImpl.run(BridgeImpl.java:286)
    at org.apache.tools.ant.module.run.TargetExecutor.run(TargetExecutor.java:555)
    at org.netbeans.core.execution.RunClassThread.run(RunClassThread.java:153)
Caused by: java.io.FileNotFoundException: C:\Program Files\NetBeans 8.0\_harvestsdetail_1417022482708_967062.java (Access is denied)
    at java.io.FileOutputStream.open(Native Method)
    at java.io.FileOutputStream.<init>(FileOutputStream.java:221)
    at java.io.FileOutputStream.<init>(FileOutputStream.java:171)
    at java.io.FileWriter.<init>(FileWriter.java:90)
    at net.sf.jasperreports.engine.util.JRSaver.saveClassSource(JRSaver.java:145)
    ... 38 more

0 个答案:

没有答案