How to construct gradle wrapper in diff folder


(jim northrop) #1

So we can
Cd newstuff
Into a folder that already has gradle wrapper.
But i need to ship copy of wrapper/new wrapper in folder above newstuff
So i really want to
Gradlew wrapper …/
Ideas pls :slight_smile:


(James Justinic) #2

The default wrapper task creates the wrapper in the project directory. However, there’s nothing that forces the location of the wrapper to be the project directory with the default task, or you can configure your own.

Don’t cd into newstuff, just use the gradlew in newstuff:

newstuff/gradlew wrapper

Or cd into newstuff, but explicitly set the project directory:

./gradlew wrapper -p ../

Or configure your own wrapper task with the parent directory instead of the project directory in the newstuff project:

task wrapper(type: Wrapper) {
    jarFile = "${projectDir.getParent()}/gradle/wrapper/gradle-wrapper.jar"
    scriptFile = "${projectDir.getParent()}/gradlew"
}