installDist: Customize the output path


(欧小川) #1

I’m using the ‘application’ plugin, and when I run the installDist task, the application is installed into the directory projectDir/build/install/. How can I configure it to change to my custom directory?
For example, I want to export the startup script to projectDir/bin/, and all dependent files to projectDir/lib/
Thanks. :pray:


(Schalk Cronjé) #2

installDist is of type Sync - https://docs.gradle.org/current/dsl/org.gradle.api.tasks.Sync.html.

Use the destinationDir to change the target directory. However, is you want to install with projectDir as the destination directory, you run the risk of wiping out your project, so you will need to make use of preserve tp ensure that does not happen.