From 7a1158484ababf5be936e4619902b8fccfe76fad Mon Sep 17 00:00:00 2001 From: michaelin007 Date: Mon, 15 Jan 2024 18:57:48 +0000 Subject: [PATCH 1/3] https://jira.baeldung.com/browse/BAEL-3205 --- gradle-modules/gradle-5/cmd-line-args/build.gradle | 2 ++ gradle-modules/gradle-5/gradle-lint-intro/build.gradle | 3 +++ gradle-modules/gradle-5/java-exec/build.gradle | 2 ++ gradle-modules/gradle-5/source-sets/build.gradle | 3 +++ gradle-modules/gradle-5/unused-dependencies/build.gradle | 3 +++ .../gradle-6/dependency-constraints/build.gradle.kts | 2 ++ gradle-modules/gradle-6/fibonacci-recursive/build.gradle.kts | 3 +++ gradle-modules/gradle-6/fibonacci-spi/build.gradle.kts | 3 +++ gradle-modules/gradle-6/httpclient-platform/build.gradle.kts | 3 +++ .../gradle-6/module-metadata-publishing/build.gradle.kts | 3 +++ gradle-modules/gradle-6/person-rest-client/build.gradle.kts | 3 +++ gradle-modules/gradle-6/widget-rest-client/build.gradle.kts | 3 +++ .../gradle-7/conditional-dependency-demo/build.gradle.kts | 2 ++ .../conditional-dependency-demo/consumer1/build.gradle.kts | 2 ++ .../conditional-dependency-demo/consumer2/build.gradle.kts | 2 ++ .../conditional-dependency-demo/provider1/build.gradle.kts | 2 ++ .../conditional-dependency-demo/provider2/build.gradle.kts | 2 ++ gradle-modules/gradle-7/gradle-javadoc/build.gradle | 2 ++ .../gradle-7/gradle-proxy-configuration/build.gradle | 2 ++ gradle-modules/gradle-7/gradle-wsdl-stubs/build.gradle | 3 +++ .../multiple-repositories-demo/publish-package/build.gradle | 2 ++ gradle-modules/gradle/build.gradle | 2 ++ gradle-modules/gradle/gradle-fat-jar/build.gradle | 3 +++ gradle-modules/gradle/gradle-to-maven/build.gradle | 2 ++ gradle-modules/gradle/gradletaskdemo/build.gradle | 3 +++ gradle-modules/gradle/greeter/build.gradle | 3 +++ gradle-modules/gradle/greeting-library-java/build.gradle | 3 +++ gradle-modules/gradle/junit5/build.gradle | 3 +++ 28 files changed, 71 insertions(+) diff --git a/gradle-modules/gradle-5/cmd-line-args/build.gradle b/gradle-modules/gradle-5/cmd-line-args/build.gradle index 15c9288024..a40b04a7a1 100644 --- a/gradle-modules/gradle-5/cmd-line-args/build.gradle +++ b/gradle-modules/gradle-5/cmd-line-args/build.gradle @@ -7,6 +7,8 @@ ext.javaMainClass = "com.baeldung.cmd.MainClass" application { mainClassName = javaMainClass } +sourceCompatibility = "1.8" +targetCompatibility = "1.8" task propertyTypes(){ doLast{ diff --git a/gradle-modules/gradle-5/gradle-lint-intro/build.gradle b/gradle-modules/gradle-5/gradle-lint-intro/build.gradle index fab83bfeec..ba32d53605 100644 --- a/gradle-modules/gradle-5/gradle-lint-intro/build.gradle +++ b/gradle-modules/gradle-5/gradle-lint-intro/build.gradle @@ -5,6 +5,9 @@ ext { awsVersion = '2.20.83' } +sourceCompatibility = "1.8" +targetCompatibility = "1.8" + dependencies { implementation platform("software.amazon.awssdk:bom:$awsVersion") diff --git a/gradle-modules/gradle-5/java-exec/build.gradle b/gradle-modules/gradle-5/java-exec/build.gradle index 08aa738902..67ea3e3d39 100644 --- a/gradle-modules/gradle-5/java-exec/build.gradle +++ b/gradle-modules/gradle-5/java-exec/build.gradle @@ -13,6 +13,8 @@ jar { ) } } +sourceCompatibility = "1.8" +targetCompatibility = "1.8" application { mainClassName = javaMainClass diff --git a/gradle-modules/gradle-5/source-sets/build.gradle b/gradle-modules/gradle-5/source-sets/build.gradle index 8325450cfd..8a65e5a845 100644 --- a/gradle-modules/gradle-5/source-sets/build.gradle +++ b/gradle-modules/gradle-5/source-sets/build.gradle @@ -3,6 +3,9 @@ apply plugin: "eclipse" apply plugin: "java" description = "Source Sets example" +sourceCompatibility = "1.8" +targetCompatibility = "1.8" + task printSourceSetInformation(){ description = "Print source set information" diff --git a/gradle-modules/gradle-5/unused-dependencies/build.gradle b/gradle-modules/gradle-5/unused-dependencies/build.gradle index d848cd0e0d..028224519c 100644 --- a/gradle-modules/gradle-5/unused-dependencies/build.gradle +++ b/gradle-modules/gradle-5/unused-dependencies/build.gradle @@ -1,6 +1,9 @@ description = "Gradle Unused Dependencies example" +sourceCompatibility = "1.8" +targetCompatibility = "1.8" + dependencies { implementation('com.google.guava:guava:29.0-jre') implementation('org.apache.httpcomponents:httpclient:4.5.12') diff --git a/gradle-modules/gradle-6/dependency-constraints/build.gradle.kts b/gradle-modules/gradle-6/dependency-constraints/build.gradle.kts index 41336d3c91..138dbcc595 100644 --- a/gradle-modules/gradle-6/dependency-constraints/build.gradle.kts +++ b/gradle-modules/gradle-6/dependency-constraints/build.gradle.kts @@ -4,6 +4,8 @@ plugins { group = "com.baeldung" version = "1.0.0" +sourceCompatibility = "1.8" +targetCompatibility = "1.8" dependencies { api("io.reactivex.rxjava2:rxjava:2.2.16") diff --git a/gradle-modules/gradle-6/fibonacci-recursive/build.gradle.kts b/gradle-modules/gradle-6/fibonacci-recursive/build.gradle.kts index 0872a52472..884175577f 100644 --- a/gradle-modules/gradle-6/fibonacci-recursive/build.gradle.kts +++ b/gradle-modules/gradle-6/fibonacci-recursive/build.gradle.kts @@ -2,6 +2,9 @@ plugins { `java-library` } +sourceCompatibility = "1.8" +targetCompatibility = "1.8" + dependencies { api(project(":fibonacci-spi")) compileOnly("com.google.auto.service:auto-service-annotations:1.0-rc6") diff --git a/gradle-modules/gradle-6/fibonacci-spi/build.gradle.kts b/gradle-modules/gradle-6/fibonacci-spi/build.gradle.kts index e571f329a9..b468793a3f 100644 --- a/gradle-modules/gradle-6/fibonacci-spi/build.gradle.kts +++ b/gradle-modules/gradle-6/fibonacci-spi/build.gradle.kts @@ -3,6 +3,9 @@ plugins { `java-test-fixtures` } +sourceCompatibility = "1.8" +targetCompatibility = "1.8" + dependencies { testFixturesApi("org.junit.jupiter:junit-jupiter-api:5.5.2") testFixturesImplementation("org.junit.jupiter:junit-jupiter-engine:5.5.2") diff --git a/gradle-modules/gradle-6/httpclient-platform/build.gradle.kts b/gradle-modules/gradle-6/httpclient-platform/build.gradle.kts index a021bff013..693f4e5452 100644 --- a/gradle-modules/gradle-6/httpclient-platform/build.gradle.kts +++ b/gradle-modules/gradle-6/httpclient-platform/build.gradle.kts @@ -2,6 +2,9 @@ plugins { `java-platform` } +sourceCompatibility = "1.8" +targetCompatibility = "1.8" + dependencies { constraints { api("org.apache.httpcomponents:fluent-hc:4.5.10") diff --git a/gradle-modules/gradle-6/module-metadata-publishing/build.gradle.kts b/gradle-modules/gradle-6/module-metadata-publishing/build.gradle.kts index 9812c72f6f..382f989e7c 100644 --- a/gradle-modules/gradle-6/module-metadata-publishing/build.gradle.kts +++ b/gradle-modules/gradle-6/module-metadata-publishing/build.gradle.kts @@ -3,6 +3,9 @@ plugins { `maven-publish` } +sourceCompatibility = "1.8" +targetCompatibility = "1.8" + publishing { publications { register("mavenJava") { diff --git a/gradle-modules/gradle-6/person-rest-client/build.gradle.kts b/gradle-modules/gradle-6/person-rest-client/build.gradle.kts index c562b3e164..3ca9d21adc 100644 --- a/gradle-modules/gradle-6/person-rest-client/build.gradle.kts +++ b/gradle-modules/gradle-6/person-rest-client/build.gradle.kts @@ -2,6 +2,9 @@ plugins { `java-library` } +sourceCompatibility = "1.8" +targetCompatibility = "1.8" + dependencies { api(platform(project(":httpclient-platform"))) implementation("org.apache.httpcomponents:fluent-hc") diff --git a/gradle-modules/gradle-6/widget-rest-client/build.gradle.kts b/gradle-modules/gradle-6/widget-rest-client/build.gradle.kts index e1af4b7f71..2f5842b8dc 100644 --- a/gradle-modules/gradle-6/widget-rest-client/build.gradle.kts +++ b/gradle-modules/gradle-6/widget-rest-client/build.gradle.kts @@ -2,6 +2,9 @@ plugins { `java-library` } +sourceCompatibility = "1.8" +targetCompatibility = "1.8" + dependencies { api(platform(project(":httpclient-platform"))) implementation("org.apache.httpcomponents:httpclient") diff --git a/gradle-modules/gradle-7/conditional-dependency-demo/build.gradle.kts b/gradle-modules/gradle-7/conditional-dependency-demo/build.gradle.kts index 95601a160d..935a23d56f 100644 --- a/gradle-modules/gradle-7/conditional-dependency-demo/build.gradle.kts +++ b/gradle-modules/gradle-7/conditional-dependency-demo/build.gradle.kts @@ -6,6 +6,8 @@ plugins { group = "com.baeldung.gradle" version = "0.0.1-SNAPSHOT" +sourceCompatibility = "1.8" +targetCompatibility = "1.8" repositories { mavenCentral() diff --git a/gradle-modules/gradle-7/conditional-dependency-demo/consumer1/build.gradle.kts b/gradle-modules/gradle-7/conditional-dependency-demo/consumer1/build.gradle.kts index 9858c5b139..5f266cae7a 100644 --- a/gradle-modules/gradle-7/conditional-dependency-demo/consumer1/build.gradle.kts +++ b/gradle-modules/gradle-7/conditional-dependency-demo/consumer1/build.gradle.kts @@ -4,6 +4,8 @@ plugins { group = "com.baeldung.gradle" version = "0.0.1-SNAPSHOT" +sourceCompatibility = "1.8" +targetCompatibility = "1.8" repositories { mavenCentral() diff --git a/gradle-modules/gradle-7/conditional-dependency-demo/consumer2/build.gradle.kts b/gradle-modules/gradle-7/conditional-dependency-demo/consumer2/build.gradle.kts index 2031aea59c..70a16e2971 100644 --- a/gradle-modules/gradle-7/conditional-dependency-demo/consumer2/build.gradle.kts +++ b/gradle-modules/gradle-7/conditional-dependency-demo/consumer2/build.gradle.kts @@ -4,6 +4,8 @@ plugins { group = "com.baeldung.gradle" version = "0.0.1-SNAPSHOT" +sourceCompatibility = "1.8" +targetCompatibility = "1.8" repositories { mavenCentral() diff --git a/gradle-modules/gradle-7/conditional-dependency-demo/provider1/build.gradle.kts b/gradle-modules/gradle-7/conditional-dependency-demo/provider1/build.gradle.kts index d3dcd96b08..8601796ac4 100644 --- a/gradle-modules/gradle-7/conditional-dependency-demo/provider1/build.gradle.kts +++ b/gradle-modules/gradle-7/conditional-dependency-demo/provider1/build.gradle.kts @@ -4,6 +4,8 @@ plugins { group = "com.baeldung.gradle" version = "0.0.1-SNAPSHOT" +sourceCompatibility = "1.8" +targetCompatibility = "1.8" repositories { mavenCentral() diff --git a/gradle-modules/gradle-7/conditional-dependency-demo/provider2/build.gradle.kts b/gradle-modules/gradle-7/conditional-dependency-demo/provider2/build.gradle.kts index d3dcd96b08..8601796ac4 100644 --- a/gradle-modules/gradle-7/conditional-dependency-demo/provider2/build.gradle.kts +++ b/gradle-modules/gradle-7/conditional-dependency-demo/provider2/build.gradle.kts @@ -4,6 +4,8 @@ plugins { group = "com.baeldung.gradle" version = "0.0.1-SNAPSHOT" +sourceCompatibility = "1.8" +targetCompatibility = "1.8" repositories { mavenCentral() diff --git a/gradle-modules/gradle-7/gradle-javadoc/build.gradle b/gradle-modules/gradle-7/gradle-javadoc/build.gradle index 5d8303d64c..761d911ad8 100644 --- a/gradle-modules/gradle-7/gradle-javadoc/build.gradle +++ b/gradle-modules/gradle-7/gradle-javadoc/build.gradle @@ -4,6 +4,8 @@ plugins { group 'org.example' version '1.0-SNAPSHOT' +sourceCompatibility = "1.8" +targetCompatibility = "1.8" javadoc { destinationDir = file("${buildDir}/docs/javadoc") diff --git a/gradle-modules/gradle-7/gradle-proxy-configuration/build.gradle b/gradle-modules/gradle-7/gradle-proxy-configuration/build.gradle index 7463486961..c6e10b053e 100644 --- a/gradle-modules/gradle-7/gradle-proxy-configuration/build.gradle +++ b/gradle-modules/gradle-7/gradle-proxy-configuration/build.gradle @@ -4,6 +4,8 @@ plugins { group = 'org.baeldung' version = '1.0-SNAPSHOT' +sourceCompatibility = "1.8" +targetCompatibility = "1.8" repositories { mavenCentral() diff --git a/gradle-modules/gradle-7/gradle-wsdl-stubs/build.gradle b/gradle-modules/gradle-7/gradle-wsdl-stubs/build.gradle index 6d0cfc1972..3917c2f401 100644 --- a/gradle-modules/gradle-7/gradle-wsdl-stubs/build.gradle +++ b/gradle-modules/gradle-7/gradle-wsdl-stubs/build.gradle @@ -3,6 +3,9 @@ plugins { id 'com.github.bjornvester.wsdl2java' version '2.0.2' } +sourceCompatibility = "1.8" +targetCompatibility = "1.8" + repositories { mavenCentral() } diff --git a/gradle-modules/gradle-7/multiple-repositories-demo/publish-package/build.gradle b/gradle-modules/gradle-7/multiple-repositories-demo/publish-package/build.gradle index bd97650e9c..89d77ddcae 100644 --- a/gradle-modules/gradle-7/multiple-repositories-demo/publish-package/build.gradle +++ b/gradle-modules/gradle-7/multiple-repositories-demo/publish-package/build.gradle @@ -5,6 +5,8 @@ plugins { group = "com.baeldung.gradle" version = "1.0.0-SNAPSHOT" +sourceCompatibility = "1.8" +targetCompatibility = "1.8" repositories { mavenLocal() diff --git a/gradle-modules/gradle/build.gradle b/gradle-modules/gradle/build.gradle index d808f4a3cc..d69a3384a8 100644 --- a/gradle-modules/gradle/build.gradle +++ b/gradle-modules/gradle/build.gradle @@ -10,6 +10,8 @@ allprojects { subprojects { version = '1.0' + sourceCompatibility = "1.8" + targetCompatibility = "1.8" } apply plugin: 'eclipse' diff --git a/gradle-modules/gradle/gradle-fat-jar/build.gradle b/gradle-modules/gradle/gradle-fat-jar/build.gradle index 4c3d86d757..55fbf2d748 100644 --- a/gradle-modules/gradle/gradle-fat-jar/build.gradle +++ b/gradle-modules/gradle/gradle-fat-jar/build.gradle @@ -13,6 +13,9 @@ plugins { id 'java' } +sourceCompatibility = JavaVersion.VERSION_1_8 +targetCompatibility = JavaVersion.VERSION_1_8 + repositories { mavenCentral() } diff --git a/gradle-modules/gradle/gradle-to-maven/build.gradle b/gradle-modules/gradle/gradle-to-maven/build.gradle index 7cd2617ef4..87f4272c13 100644 --- a/gradle-modules/gradle/gradle-to-maven/build.gradle +++ b/gradle-modules/gradle/gradle-to-maven/build.gradle @@ -10,6 +10,8 @@ group = 'com.baeldung' // by default, pom's artifactId is taken from the directory name version = '0.0.1' +sourceCompatibility = JavaVersion.VERSION_1_8 +targetCompatibility = JavaVersion.VERSION_1_8 dependencies { implementation 'org.slf4j:slf4j-api:1.7.25' diff --git a/gradle-modules/gradle/gradletaskdemo/build.gradle b/gradle-modules/gradle/gradletaskdemo/build.gradle index 5f07573365..cb8f285fa0 100644 --- a/gradle-modules/gradle/gradletaskdemo/build.gradle +++ b/gradle-modules/gradle/gradletaskdemo/build.gradle @@ -13,6 +13,9 @@ plugins { id 'java' } +sourceCompatibility = JavaVersion.VERSION_1_8 +targetCompatibility = JavaVersion.VERSION_1_8 + apply from: 'aplugin.gradle' apply plugin: 'org.shipkit.bintray-release' diff --git a/gradle-modules/gradle/greeter/build.gradle b/gradle-modules/gradle/greeter/build.gradle index 0aab8c2313..bc6f800ea0 100644 --- a/gradle-modules/gradle/greeter/build.gradle +++ b/gradle-modules/gradle/greeter/build.gradle @@ -1,6 +1,9 @@ apply plugin : 'java' apply plugin : 'application' +sourceCompatibility = JavaVersion.VERSION_1_8 +targetCompatibility = JavaVersion.VERSION_1_8 + dependencies { implementation project(':greeting-library') implementation project(':greeting-library-java') diff --git a/gradle-modules/gradle/greeting-library-java/build.gradle b/gradle-modules/gradle/greeting-library-java/build.gradle index 916a9a435e..778536ba49 100644 --- a/gradle-modules/gradle/greeting-library-java/build.gradle +++ b/gradle-modules/gradle/greeting-library-java/build.gradle @@ -1,6 +1,9 @@ apply plugin :'java' //apply plugin : 'application' +sourceCompatibility = JavaVersion.VERSION_1_8 +targetCompatibility = JavaVersion.VERSION_1_8 + dependencies{ implementation group: 'joda-time', name: 'joda-time', version: '2.9.9' testImplementation group: 'junit', name: 'junit', version: '4.12' diff --git a/gradle-modules/gradle/junit5/build.gradle b/gradle-modules/gradle/junit5/build.gradle index e589541e08..41c870e6f6 100644 --- a/gradle-modules/gradle/junit5/build.gradle +++ b/gradle-modules/gradle/junit5/build.gradle @@ -3,6 +3,9 @@ plugins { id 'java-library' } +sourceCompatibility = JavaVersion.VERSION_1_8 +targetCompatibility = JavaVersion.VERSION_1_8 + dependencies { testImplementation 'org.junit.jupiter:junit-jupiter-api:5.3.1' testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.3.1' From 0b55315e8e530c7ad73d6773598ab98976f37189 Mon Sep 17 00:00:00 2001 From: michaelin007 Date: Tue, 16 Jan 2024 10:59:00 +0000 Subject: [PATCH 2/3] https://jira.baeldung.com/browse/BAEL-3205 --- gradle-modules/gradle/build.gradle | 2 -- gradle-modules/gradle/greeting-library/build.gradle | 5 +++++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/gradle-modules/gradle/build.gradle b/gradle-modules/gradle/build.gradle index d69a3384a8..d808f4a3cc 100644 --- a/gradle-modules/gradle/build.gradle +++ b/gradle-modules/gradle/build.gradle @@ -10,8 +10,6 @@ allprojects { subprojects { version = '1.0' - sourceCompatibility = "1.8" - targetCompatibility = "1.8" } apply plugin: 'eclipse' diff --git a/gradle-modules/gradle/greeting-library/build.gradle b/gradle-modules/gradle/greeting-library/build.gradle index a8fa91963c..16304cd5ed 100644 --- a/gradle-modules/gradle/greeting-library/build.gradle +++ b/gradle-modules/gradle/greeting-library/build.gradle @@ -7,3 +7,8 @@ dependencies { exclude module : 'groovy-all' } } + +java { + sourceCompatibility = JavaVersion.VERSION_1_8 + targetCompatibility = JavaVersion.VERSION_1_8 +} From b9c8a43ff024f5cd14c4cb8007fbd05709be1b90 Mon Sep 17 00:00:00 2001 From: michaelin007 Date: Wed, 17 Jan 2024 02:34:51 +0000 Subject: [PATCH 3/3] https://jira.baeldung.com/browse/BAEL-3205 --- gradle-modules/gradle/gradle-employee-app/build.gradle | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gradle-modules/gradle/gradle-employee-app/build.gradle b/gradle-modules/gradle/gradle-employee-app/build.gradle index c7040504f1..03d28f7e20 100644 --- a/gradle-modules/gradle/gradle-employee-app/build.gradle +++ b/gradle-modules/gradle/gradle-employee-app/build.gradle @@ -6,8 +6,8 @@ plugins { apply plugin: 'application' mainClassName = 'employee.EmployeeApp' -sourceCompatibility = JavaVersion.VERSION_1_8 -targetCompatibility = JavaVersion.VERSION_1_8 +sourceCompatibility = "1.8" +targetCompatibility = "1.8" println 'This is executed during configuration phase'