Java 在buildscript中应用外部脚本时,gradle.properties中不提供键/值对
我正在使用Gradle3.2.1(请参阅Java 在buildscript中应用外部脚本时,gradle.properties中不提供键/值对,java,gradle,groovy,Java,Gradle,Groovy,我正在使用Gradle3.2.1(请参阅包装器任务)。我有: (1)此build.gradle脚本: buildscript { repositories { mavenLocal() } apply from: 'gradle/buildscript.gradle', to: buildscript } plugins { // ... } repositories { //mavenLocal() mavenCentral() } apply plug
包装器任务)。我有:
(1)此build.gradle
脚本:
buildscript {
repositories {
mavenLocal()
}
apply from: 'gradle/buildscript.gradle', to: buildscript
}
plugins {
// ...
}
repositories {
//mavenLocal()
mavenCentral()
}
apply plugin: 'idea'
apply plugin: 'io.spring.dependency-management'
apply plugin: 'java'
apply plugin: 'org.springframework.boot'
group 'io.shido'
version "${rootProject.version}"
dependencyManagement {
imports {
mavenBom("org.springframework.boot:spring-boot-dependencies:${spring_boot_version}")
}
}
dependencies {
apt "org.projectlombok:lombok:${lombok_version}"
compile 'org.springframework.boot:spring-boot-starter-actuator'
testCompile 'org.springframework.boot:spring-boot-starter-test'
}
task wrapper(type: Wrapper) {
gradleVersion '3.2.1'
}
(2)此buildscript.gradle
(位于${project.root}/gradle
内):
(3)和gradle.properties
(位于${project.root}
):
问题是,一旦我进行了此设置,Gradle就无法再访问Gradle.properties
(对于任何脚本)中定义的键/值对。因此,我无法访问中的spring\u dependencies\u management\u version
,spring\u boot\u version
(例如)的值
有什么线索吗
注意:如果我不将Gradle配置拆分到不同的文件中,一切都很好,但这不是一个选项
//
// Executed in the context of `buildscript { }`
repositories {
mavenLocal()
}
dependencies {
classpath("io.spring.gradle:dependency-management-plugin:${spring_dependencies_management_version}")
classpath("org.springframework.boot:spring-boot-gradle-plugin:${spring_boot_version}")
}
#
# Global Project's Properties/Settings
rootProject.version = 0.1.0-SNAPSHOT
#
# Dependency Versions
spring_boot_version = 1.4.2.RELEASE
spring_dependencies_management_version = 0.6.0.RELEASE