Skip to content

Commit 9b64970

Browse files
authored
Merge pull request eugenp#12395 from hkhan/JAVA-12742-fix-gradle-build
[JAVA-12742] Fix Gradle parent modue to work with Gradle 7.x
2 parents 3d95fae + 86ccb59 commit 9b64970

File tree

13 files changed

+38
-43
lines changed

13 files changed

+38
-43
lines changed

gradle/README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,3 @@ This module contains articles about Gradle
66
- [Introduction to Gradle](https://www.baeldung.com/gradle)
77
- [Writing Custom Gradle Plugins](https://www.baeldung.com/gradle-create-plugin)
88
- [A Custom Task in Gradle](https://www.baeldung.com/gradle-custom-task)
9-
- [Dependency Management in Gradle](https://www.baeldung.com/gradle-dependency-management)

gradle/build.gradle

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
1+
plugins {
2+
id 'org.shipkit.bintray-release' version '2.3.5'
3+
}
4+
15
allprojects {
26
repositories {
3-
jcenter()
7+
mavenCentral()
48
}
59
}
610

7-
811
subprojects {
9-
1012
version = '1.0'
1113
}
1214

@@ -89,4 +91,4 @@ task printJavaVersionBuildSrc(type : PrintToolVersionBuildSrcTask) {
8991

9092
task printGroovyVersionBuildSrc(type : PrintToolVersionBuildSrcTask) {
9193
tool 'groovy'
92-
}
94+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
### Relevant Articles:
2+
3+
- [Dependency Management in Gradle](https://www.baeldung.com/gradle-dependency-management)
4+
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
rootProject.name = 'dependencymanagement'
1+
rootProject.name = 'gradle-dependency-management'

gradle/gradle-employee-app/build.gradle

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,31 +6,30 @@ plugins {
66
apply plugin: 'application'
77
mainClassName = 'employee.EmployeeApp'
88

9-
java {
10-
sourceCompatibility = JavaVersion.VERSION_1_8
11-
targetCompatibility = JavaVersion.VERSION_1_8
12-
}
9+
sourceCompatibility = JavaVersion.VERSION_1_8
10+
targetCompatibility = JavaVersion.VERSION_1_8
1311

1412
println 'This is executed during configuration phase'
1513

1614
task configured {
1715
println 'The project is configured'
1816
}
1917

20-
task wrapper(type: Wrapper){
18+
wrapper {
2119
gradleVersion = '5.3.1'
2220
}
2321

2422
repositories {
25-
jcenter()
23+
mavenCentral()
2624
}
2725

2826
dependencies {
2927

30-
compile group: 'org.apache.commons', name: 'commons-lang3', version: '3.10'
28+
implementation group: 'org.apache.commons', name: 'commons-lang3', version: '3.10'
3129
testImplementation('junit:junit:4.13')
32-
testRuntime('junit:junit:4.13')
30+
testRuntimeOnly('junit:junit:4.13')
3331
}
32+
3433
test {
3534
useJUnit()
3635
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
rootProject.name = 'gradle-employee-app'
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
rootProject.name = 'gradle-source-vs-target-compatibility'

gradle/gradletaskdemo/build.gradle

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,14 @@ buildscript {
55
}
66
}
77
dependencies {
8-
classpath "org.shipkit:shipkit:0.9.117"
8+
classpath "org.shipkit:shipkit:2.3.5"
99
}
1010
}
1111

12-
1312
plugins {
1413
id 'java'
1514
}
1615

17-
1816
apply from: 'aplugin.gradle'
1917
apply plugin: 'org.shipkit.bintray-release'
2018

@@ -72,8 +70,6 @@ helloBaeldung {
7270
}
7371

7472

75-
76-
7773
//Adding extra task properties
7874
task ourTask {
7975
ext.theProperty = "theValue"
@@ -86,25 +82,24 @@ task printTaskProperty {
8682
}
8783

8884

89-
9085
//Declaring dependencies
9186
dependencies {
92-
compile group:
87+
implementation group:
9388
'org.springframework', name: 'spring-core', version: '4.3.5.RELEASE'
94-
compile 'org.springframework:spring-core:4.3.5.RELEASE',
89+
implementation 'org.springframework:spring-core:4.3.5.RELEASE',
9590
'org.springframework:spring-aop:4.3.5.RELEASE'
96-
compile(
91+
implementation(
9792
[group: 'org.springframework', name: 'spring-core', version: '4.3.5.RELEASE'],
9893
[group: 'org.springframework', name: 'spring-aop', version: '4.3.5.RELEASE']
9994
)
100-
testCompile('org.hibernate:hibernate-core:5.2.12.Final') {
95+
testImplementation('org.hibernate:hibernate-core:5.2.12.Final') {
10196
transitive = true
10297
}
103-
runtime(group: 'org.hibernate', name: 'hibernate-core', version: '5.2.12.Final') {
98+
runtimeOnly(group: 'org.hibernate', name: 'hibernate-core', version: '5.2.12.Final') {
10499
transitive = false
105100
}
106-
runtime "org.codehaus.groovy:groovy-all:2.4.11@jar"
107-
runtime group: 'org.codehaus.groovy', name: 'groovy-all', version: '2.4.11', ext: 'jar'
108-
109-
compile fileTree(dir: 'libs', include: '*.jar')
101+
runtimeOnly "org.codehaus.groovy:groovy-all:2.4.11@jar"
102+
runtimeOnly group: 'org.codehaus.groovy', name: 'groovy-all', version: '2.4.11', ext: 'jar'
103+
104+
implementation fileTree(dir: 'libs', include: '*.jar')
110105
}

gradle/gradletaskdemo/build/tmp/jar/MANIFEST.MF

Lines changed: 0 additions & 2 deletions
This file was deleted.

gradle/greeter/build.gradle

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
apply plugin : 'java'
22
apply plugin : 'application'
33

4-
5-
64
dependencies {
7-
compile project(':greeting-library')
8-
compile project(':greeting-library-java')
5+
implementation project(':greeting-library')
6+
implementation project(':greeting-library-java')
7+
8+
implementation group: 'org.codehaus.groovy', name: 'groovy-all', version: '2.4.11', ext: 'jar'
99
}
1010

1111
mainClassName = 'greeter.Greeter'

0 commit comments

Comments
 (0)