为了不凌乱我的项目的顶级目录,我希望gradle包装器JAR落在子目录中,例如: infra
。我想要这样的事情:
root
L .infra
L gradle
L wrapper
L gradle-wrapper.jar
L gradle-wrapper.properties
我希望archiveBase
或distributionBase
能够让我在那里,但即使强行执行这些设置,我仍然会在最高级别中使用gradle
。
configure(rootProject) {
task wrapper(type: Wrapper) {
description = 'Generates gradlew and gradlew.bat scripts'
gradleVersion = '3.2'
archiveBase = Wrapper.PathBase.PROJECT
archivePath = ".infra/"
distributionBase = Wrapper.PathBase.PROJECT
distributionPath = ".infra/"
}
}
我做错了什么?
答案 0 :(得分:2)
这些路径将在gradle/wrapper/gradle-wrapper.properties
中设置。
distributionBase=PROJECT
distributionPath=infra/ <----
zipStoreBase=PROJECT
zipStorePath=infra/ <----
您可以使用以下属性设置包装脚本和 jar 的路径。
jarFile = "${project.projectDir}/.infra/gradle-wrapper.jar" // archive
scriptFile = "${project.projectDir}/.infra/gradlew" // wrapper script