Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to specify classes output directory for Gradle 4?

Tags:

gradle

Gradle project deprecated 'classesDir' so the previously working method:

sourceSets {
    main {
        output.classesDir = "myDir"
    }
}

should be replaced with something else. Documentation talks about 'output.classesDirs' but this is read-only property.

What is the method to specify custom compilation output directory in Gradle 4.x scripts?

like image 930
Dimitar II Avatar asked Dec 10 '25 03:12

Dimitar II


1 Answers

If you are working with java you can do this

 apply plugin: 'java'

 sourceSets {
   main {
     // Compiled Java classes should use this directory
     java.outputDir = file('myDir')
   }
 }

See more: https://docs.gradle.org/current/javadoc/org/gradle/api/tasks/SourceSetOutput.html

like image 143
lbovolini Avatar answered Dec 16 '25 01:12

lbovolini



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!