简体   繁体   中英

Define path to Gradle Wrapper

To not clutter my project's top-level directory I would like the gradle wrapper JAR to land in a subdirectory, eg infra . I'm going for something like this:

root
 L .infra
    L gradle
       L wrapper
          L gradle-wrapper.jar
          L gradle-wrapper.properties

I hoped that archiveBase or distributionBase would get me there but even if brute forcing these settings, I still end up with gradle in the top level.

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/"
    }

}

What am I doing wrong?

These paths will be set in the gradle/wrapper/gradle-wrapper.properties .

distributionBase=PROJECT
distributionPath=infra/ <---- 
zipStoreBase=PROJECT
zipStorePath=infra/ <----

You can set the path to wrapper script and jar by using following properties.

jarFile = "${project.projectDir}/.infra/gradle-wrapper.jar" // archive
scriptFile = "${project.projectDir}/.infra/gradlew" // wrapper script

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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