From the Gradle's code I found that there are methods : TemporaryFileProvider and TestNameTestDirectoryProvider for creating temporary file and folder but they are not part of the public API.
org.gradle.api.internal.file.TemporaryFileProvider
org.gradle.test.fixtures.file.TestNameTestDirectoryProvider
If there any methods from the public Gradle's API that gives the user ability to create temporary files and folders and if not what are the best ways to do it?
PS. I use org.junit.rules.TemporaryFolder
for JUnit tests and Java's File.createTempFile
Open your File Explorer (it's usually the first button on your desktop taskbar, looks like a folder). Go to the "This PC" section on the left, and then double-click your C: drive. On the Home tab at the top, click "New Folder" and name it "Temp".
A temporary file can be created using the method java. io. File. createTempFile().
Task implementations can use task.getTemporaryDir().createNewFile()
. What to use in JUnit tests isn't Gradle's business, but org.junit.rules.TemporaryFolder
would be my default choice.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With