Instructor: Todd Dole
Semester: Fall 2024
chmod u+x ./gradlew
-- linux/mac command to make gradlew executable
./gradlew build
-- builds the entire project
./gradlew clean
-- deletes all build files / compiled classes. Useful for exchanging source.
Put this into your build.gradle.kts file:
tasks.register("compileSpecificClass") { source = fileTree("src/main/java") { include("com/example/MyClass.java") // Replace with the specific path to your class
} classpath = sourceSets["main"].compileClasspath destinationDirectory.set(file("build/classes/java/main")) // Output directory options.compilerArgs.add("-Xlint:deprecation") // Optional: additional compiler arguments }
Then, reload gradle and you can run:
./gradlew compileSpecificClass
Alternately, you can just compile directly from the command line with javac:
javac -cp build/classes/java/main src/main/java/com/example/MyClass.java