Gradle问题:找不到net.sf.jasperreports:jasperreports

时间:2014-03-19 10:22:16

标签: java gradle

我正在尝试使用gradle编译jasper。但它显示我错误

 >gradle  -q compileJasperJava

FAILURE: Build failed with an exception.

Execution failed for task ':compileJasperJava'.
> Could not resolve all dependencies for configuration ':jasperreports'.
   > Could not find net.sf.jasperreports:jasperreports:5.5.1.
     Required by:
         :Jasper:unspecified 

我的build.gradle代码是

 configurations {
    jasperreports {
        transitive = true
    }
}
dependencies {     
    jasperreports 'net.sf.jasperreports:jasperreports:5.5.1' 
}

apply plugin: 'java' 
task compileOne (type: JavaCompile) {
    source = sourceSets.main.java.srcDirs
    include 'main/java/hello/JasperDemo.java'
    classpath = sourceSets.main.compileClasspath
    destinationDir = sourceSets.main.output.classesDir
} 
compileOne.options.compilerArgs = ["-sourcepath", "$projectDir/src/main/java"]

task compileJasperJava(dependsOn: 'compileOne') << {
    def jasperSourceDir = file('src')
    def jasperTargetDir = file('build/classes/main/jasperreports')
    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

我使用了this maven jasper depencies 为什么这个错误&gt;如何解决这个问题?

0 个答案:

没有答案