Created
June 11, 2022 17:20
-
-
Save rivancic/5f55224e5f3b7a608413fa5944a22013 to your computer and use it in GitHub Desktop.
Gradle Task Printing Content of a file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tasks.register("printBuild") { // Register task named printBuild | |
doLast { // What should be executed - action | |
// Open a file in BufferedReader | |
try (BufferedReader br = new BufferedReader(new FileReader(layout.buildDirectory.dir("resources/main/git.properties").get().getAsFile()))) { | |
String line; | |
while ((line = br.readLine()) != null) { | |
System.out.println(line); | |
} | |
} | |
} | |
} | |
build.finalizedBy(printBuild) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment