javagradleiofilewriter

"Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0." while using FileWriter Class to output the file in Java


I tried to write an FileWriter to output my file.

public class TestWriter{
    public static void main(String[] args){
        FileWriter fw = new FileWriter("\\User\\Eric\\Desktop\\writer.txt"); //absolute position
            fw.write("testing");           //write some content in my text file
            fw.flush();                    //force to output the source from buffer zone
            fw.close();                    //close the IOstream and release the source
    }
}

and the result said

"Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0."

I have tried to lower my gradle version ,but it still didn't work. Sorry to ask this basic question and I'll really appreciate anyone to solve my problem.

Here's my gradle document

plugins {
    id 'org.jetbrains.kotlin.jvm' version '1.5.10'
    id 'java'
}

group 'org.example'
version '1.0-SNAPSHOT'

repositories {
    mavenCentral()
    mavenCentral()
}


dependencies {
    implementation "org.jetbrains.kotlin:kotlin-stdlib"
    testImplementation 'org.junit.jupiter:junit-jupiter-api:5.7.0'
    testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.7.0'
    // https://mvnrepository.com/artifact/org.junit.jupiter/junit-jupiter-api

}

test {
    useJUnitPlatform()
}

Solution

  • Try gradle --version and compare it with ./gradlew wrapper --version; maybe what you need to downgrade is gradle-wrapper rather than gradle itself.


    However, that's simply a warning that your code or some dependency is using some Gradle feature that was deprecated.

    This is not an error per-se.

    A deprecation is just a warning, about the need to update the currently running code in order to be able to upgrade when the Gradle 8.0 API will be released.
    Only at that point you'll be forced to fix the problem.

    You can ignore it, for now. But don't forget it.