简体   繁体   English

Gradle不执行子项目

[英]Gradle does not execute subprojects

Currently I'm trying to migrate my project to gradle from maven and to do so I'm creating a custom script which generates gradle build files from pom files taking into account all project specifics. 目前,我正在尝试将项目从Maven迁移到gradle,并这样做是为了创建自定义脚本,该脚本将考虑所有项目细节的pom文件生成gradle构建文件。 Script generates "build-generated.gradle" file which is meant to be executed on configuration phase from build.gradle file. 脚本会生成“ build-generation.gradle”文件,该文件应在build.gradle文件的配置阶段执行。

//Text of common build.gradle:
println "Configuring ${project.name}"
apply from: 'build-generated.gradle'

The problem is that when I try to run "gradle build" the result is not what I'm expecting: An initialization phase all subprojects are included and futhermore I can print names of all subprojects using 问题是,当我尝试运行“ gradle build”时,结果不是我期望的:初始化阶段包括所有子项目,而且我可以使用以下命令打印所有子项目的名称

subprojects{
    println "I'm ${project.name}"
}

but at configuration and execution phase the subproject's build.gradle files are not executed. 但是在配置和执行阶段,不会执行子项目的build.gradle文件。

What am I doing wrong? 我究竟做错了什么?

问题是将根项目添加到settings.gradle中的include链中

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM