Unable to compile jasper using gradle


(rani sinha) #1

I followed tutorial from this website for compiling the jrxml file into jasper.

I tried the same for compiling my jrxml file as below but i am getting error:

Errors :

C:\eclipse\wkspc\Jasper>gradle --stacktrace
          FAILURE: Build failed with an exception.
          * Where:
    Build file 'C:\eclipse\wkspc\Jasper\build.gradle' line: 21
          * What went wrong:
    A problem occurred evaluating root project 'Jasper'.
    > Could not find property 'classes' on root project 'Jasper'.
          * Try:
    Run with --info or --debug option to get more log output.
          * Exception is:
    org.gradle.api.GradleScriptException: A problem occurred evaluating root project 'Jasper'.
            at org.gradle.groovy.scripts.internal.DefaultScriptRunnerFactory$ScriptRunnerImpl.run(DefaultScriptRunnerFactory.java:54)
            at org.gradle.configuration.DefaultScriptPluginFactory$ScriptPluginImpl.apply(DefaultScriptPluginFactory.java:177)
            at org.gradle.configuration.project.BuildScriptProcessor.execute(BuildScriptProcessor.java:38)
            at org.gradle.configuration.project.BuildScriptProcessor.execute(BuildScriptProcessor.java:25)
            at org.gradle.configuration.project.ConfigureActionsProjectEvaluator.evaluate(ConfigureActionsProjectEvaluator.java:34)
            at org.gradle.configuration.project.LifecycleProjectEvaluator.evaluate(LifecycleProjectEvaluator.java:55)
            at org.gradle.api.internal.project.AbstractProject.evaluate(AbstractProject.java:507)
            at org.gradle.api.internal.project.AbstractProject.evaluate(AbstractProject.java:82)
            at org.gradle.configuration.DefaultBuildConfigurer.configure(DefaultBuildConfigurer.java:31)
            at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:142)
            at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:113)
            at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:81)
            at org.gradle.launcher.exec.InProcessBuildActionExecuter$DefaultBuildController.run(InProcessBuildActionExecuter.java:64)
            at org.gradle.launcher.cli.ExecuteBuildAction.run(ExecuteBuildAction.java:33)
            at org.gradle.launcher.cli.ExecuteBuildAction.run(ExecuteBuildAction.java:24)
            at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:35)
            at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:26)
            at org.gradle.launcher.cli.RunBuildAction.run(RunBuildAction.java:50)
            at org.gradle.internal.Actions$RunnableActionAdapter.execute(Actions.java:171)
            at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:201)
            at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:174)
            at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:170)
            at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:139)
            at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:33)
            at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:22)
            at org.gradle.launcher.Main.doAction(Main.java:46)
            at org.gradle.launcher.bootstrap.EntryPoint.run(EntryPoint.java:45)
            at org.gradle.launcher.Main.main(Main.java:37)
            at org.gradle.launcher.bootstrap.ProcessBootstrap.runNoExit(ProcessBootstrap.java:50)
            at org.gradle.launcher.bootstrap.ProcessBootstrap.run(ProcessBootstrap.java:32)
            at org.gradle.launcher.GradleMain.main(GradleMain.java:23)
    Caused by: groovy.lang.MissingPropertyException: Could not find property 'classes' on root project 'Jasper'.
            at org.gradle.api.internal.AbstractDynamicObject.propertyMissingException(AbstractDynamicObject.java:43)
            at org.gradle.api.internal.AbstractDynamicObject.getProperty(AbstractDynamicObject.java:35)
            at org.gradle.api.internal.CompositeDynamicObject.getProperty(CompositeDynamicObject.java:94)
            at org.gradle.groovy.scripts.BasicScript.propertyMissing(BasicScript.java:66)
            at build_1gd9osjtknqhs7ujdaggmldmrq.run(C:\eclipse\wkspc\Jasper\build.gradle:21)
            at org.gradle.groovy.scripts.internal.DefaultScriptRunnerFactory$ScriptRunnerImpl.run(DefaultScriptRunnerFactory.java:52)
            ... 30 more
                BUILD FAILED
          Total time: 7.443 secs

My project folder structure

build.gradle file

configurations {
        jasperreports {
            transitive = true
        }
    }
    dependencies {
        jasperreports 'net.sf.jasperreports:jasperreports:5.0.1'
    }
    task compileJasperJava(dependsOn: 'compileJava') << {
        def jasperSourceDir = file('src')
        def jasperTargetDir = file('target')
        ant {
            taskdef(name: 'jrc', classname: 'net.sf.jasperreports.ant.JRAntCompileTask', classpath: configurations.jasperreports.asPath)
            jasperTargetDir.mkdirs()
            jrc(srcdir: jasperSourceDir, destdir: jasperTargetDir) {
                classpath(path: sourceSets.main.output.classesDir)
                include(name: '**/*.jrxml')
            }
        }
    }
    classes.dependsOn compileJasperJava

(Peter Niederwieser) #2

I already responded to this over at Stack Overflow.