gradle将子项目返回为null

时间:2015-11-26 08:12:27

标签: java gradle

我希望迭代项目的子项目以及每个具有特定参数的项目调用if (Font.isNativeFontSchemeSupported()){ Dialog.show("Supported?", "Yes it is supported" + Font.getDefaultFont(), "Ok", null); } 任务。

项目结构就像这样

JavaExec

我试图像这样做,但它会抛出错误

rootProject\
settings.gradle
 build.gradle
    semiRootProject\
    build.gradle
        application\
        build.gradle
        proj1\
        gradle.properties
        proj2\
        gradle.properties

错误是

task packageJar(dependsOn: build) {    
    project(":semiRootProject").subprojects.each { 

        logger.lifecycle "Project name: " it.name
        if (it.name != "application") {

            doLast {
                javaexec {
                    main = 'com.xxxx.util.KiePackageCreator'
                    classpath = sourceSets.main.runtimeClasspath + it.sourceSets.main.runtimeClasspath
                    args = [ it.name, it.group , it.version, it.buildDir ]
                }
            }
        }
    }
}

问题是什么?

1 个答案:

答案 0 :(得分:1)

似乎,您正在尝试将部分消息文本作为记录器参数传递,因此只需尝试修改此行:

logger.lifecycle "Project name: " it.name

logger.lifecycle "Project name: " + it.name