gradle – 项目 ‘customjrxml’ 在根项目 ‘customjrxml’ 中未找到

huangapple go评论96阅读模式
英文:

gradle - Project 'customjrxml' not found in root project 'customjrxml'

问题

以下是我的中文翻译:

在进行 Gradle 构建时,我遇到了以下错误。以下是我的 build.gradle 和 settings.gradle 文件。请帮我解决这个问题。

> org.gradle.execution.taskpath.ProjectFinderByTaskPath$ProjectLookupException:
> 在根项目 'customjrxml' 中找不到项目 'customjrxml'。 在
> org.gradle.execution.taskpath.ProjectFinderByTaskPath.findProject(ProjectFinderByTaskPath.java:47)
> 在
> org.gradle.execution.taskpath.TaskPathResolver.resolvePath(TaskPathResolver.java:49)
> 在
> org.gradle.execution.TaskSelector.getSelection(TaskSelector.java:96)

build.gradle:

apply plugin: 'java'
repositories {
    mavenCentral()
    jcenter()
    flatDir {
	  println '在 repositories 中';
	  dirs 'libs'
    }
}

configurations.create('jasperreports')
configurations.jasperreports {
 transitive = true
}
dependencies {
    jasperreports fileTree(dir: 'libs',include: '*.jar')
 }

task compileJasperJava {
    def jasperSourceDir = file('src/main/jasperreports')
    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) {
            include(name:'**/*.jrxml')
        }
    }
}

classes.dependsOn compileJasperJava

settings.gradle:

rootProject.name = 'customjrxml'

libs 目录中包含了 Jasper 和 Apache Commons Logging 所需的 jar 文件。

英文:

i get below error while gradle build. Below is my build gradle and settings gradle files. help me to resolve it.

> org.gradle.execution.taskpath.ProjectFinderByTaskPath$ProjectLookupException:
> Project 'customjrxml' not found in root project 'customjrxml'. at
> org.gradle.execution.taskpath.ProjectFinderByTaskPath.findProject(ProjectFinderByTaskPath.java:47)
> at
> org.gradle.execution.taskpath.TaskPathResolver.resolvePath(TaskPathResolver.java:49)
> at
> org.gradle.execution.TaskSelector.getSelection(TaskSelector.java:96)

build.gradle:

apply plugin: 'java'
repositories {
    mavenCentral()
    jcenter()
    flatDir {
	  println 'in repositories'
	  dirs 'libs'
    }
}

configurations.create('jasperreports')
configurations.jasperreports {
 transitive = true
}
dependencies {
    jasperreports fileTree(dir: 'libs',include: '*.jar')
 }

task compileJasperJava {
    def jasperSourceDir = file('src/main/jasperreports')
    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) {
            include(name:'**/*.jrxml')
        }
    }
}

classes.dependsOn compileJasperJava

settings.gradle:

rootProject.name = 'customjrxml'

libs dir is having required jar files for jasper and apache commons logging.

答案1

得分: -1

问题出在我使用的gradle build命令上。gradle项目结构似乎有问题,目前已将修改过的gradle customjrxml:build更改为gradle build,然后它就正常工作了。

英文:

Issue is with gradle build command i have used. gradle project strucuture seems wrong, as of nowmodified gradle customjrxml:build to gradle build and it worked.

huangapple
  • 本文由 发表于 2020年10月25日 19:23:12
  • 转载请务必保留本文链接:https://go.coder-hub.com/64523134.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定