英文:
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.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论