plugins { id 'java' } group 'de.oszimt.ls' version '1.0-SNAPSHOT' repositories { mavenCentral() } dependencies { testImplementation 'org.junit.jupiter:junit-jupiter-api:5.6.0' testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine' } test { useJUnitPlatform() } /** * 1st approach: Setting encoding during compilation in Java and Test classes */ compileJava.options.encoding = "UTF-8" compileTestJava.options.encoding = "UTF-8" /** * 2nd approach: Setting encoding during compilation in Java and Test classes */ tasks.withType(JavaCompile) { options.encoding = "UTF-8" } tasks.withType(Test) { systemProperty "file.encoding", "UTF-8" }