Pierre Smits
Pierre Smits

Reputation: 90

how do I control where gradle/gradlew files and folders are located

In a new project - in which I am using gradle/gradlew - I want to set the location of various gradle/gradlew files and folders to something different than the default behaviour.

I am talking about:

But how and where do I configure this?

Upvotes: 4

Views: 5417

Answers (1)

Benjamin Muschko
Benjamin Muschko

Reputation: 33436

You can change the location of the Wrapper and properties file by setting up a task of type Wrapper. For example:

task wrapper(type: Wrapper) {
    jarFile = file('mywrapper/wrapper.jar')
}

Running gradle wrapper will generate the following files:

.
├── build.gradle
├── gradlew
├── gradlew.bat
└── mywrapper
    ├── wrapper.jar
    └── wrapper.properties

The default build output directory can be changed via the method Project.setBuildDir(Object). For example:

buildDir = file('target')

Upvotes: 6

Related Questions