Merge pull request #12395 from hkhan/JAVA-12742-fix-gradle-build

[JAVA-12742] Fix Gradle parent modue to work with Gradle 7.x
This commit is contained in:
kwoyke 2022-06-23 12:06:57 +02:00 committed by GitHub
commit 48b451fd70
13 changed files with 38 additions and 43 deletions

View File

@ -6,4 +6,3 @@ This module contains articles about Gradle
- [Introduction to Gradle](https://www.baeldung.com/gradle)
- [Writing Custom Gradle Plugins](https://www.baeldung.com/gradle-create-plugin)
- [A Custom Task in Gradle](https://www.baeldung.com/gradle-custom-task)
- [Dependency Management in Gradle](https://www.baeldung.com/gradle-dependency-management)

View File

@ -1,12 +1,14 @@
plugins {
id 'org.shipkit.bintray-release' version '2.3.5'
}
allprojects {
repositories {
jcenter()
mavenCentral()
}
}
subprojects {
version = '1.0'
}
@ -89,4 +91,4 @@ task printJavaVersionBuildSrc(type : PrintToolVersionBuildSrcTask) {
task printGroovyVersionBuildSrc(type : PrintToolVersionBuildSrcTask) {
tool 'groovy'
}
}

View File

@ -0,0 +1,4 @@
### Relevant Articles:
- [Dependency Management in Gradle](https://www.baeldung.com/gradle-dependency-management)

View File

@ -1 +1 @@
rootProject.name = 'dependencymanagement'
rootProject.name = 'gradle-dependency-management'

View File

@ -6,10 +6,8 @@ plugins {
apply plugin: 'application'
mainClassName = 'employee.EmployeeApp'
java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
println 'This is executed during configuration phase'
@ -17,20 +15,21 @@ task configured {
println 'The project is configured'
}
task wrapper(type: Wrapper){
wrapper {
gradleVersion = '5.3.1'
}
repositories {
jcenter()
mavenCentral()
}
dependencies {
compile group: 'org.apache.commons', name: 'commons-lang3', version: '3.10'
implementation group: 'org.apache.commons', name: 'commons-lang3', version: '3.10'
testImplementation('junit:junit:4.13')
testRuntime('junit:junit:4.13')
testRuntimeOnly('junit:junit:4.13')
}
test {
useJUnit()
}

View File

@ -0,0 +1 @@
rootProject.name = 'gradle-employee-app'

View File

@ -0,0 +1 @@
rootProject.name = 'gradle-source-vs-target-compatibility'

View File

@ -5,16 +5,14 @@ buildscript {
}
}
dependencies {
classpath "org.shipkit:shipkit:0.9.117"
classpath "org.shipkit:shipkit:2.3.5"
}
}
plugins {
id 'java'
}
apply from: 'aplugin.gradle'
apply plugin: 'org.shipkit.bintray-release'
@ -72,8 +70,6 @@ helloBaeldung {
}
//Adding extra task properties
task ourTask {
ext.theProperty = "theValue"
@ -86,25 +82,24 @@ task printTaskProperty {
}
//Declaring dependencies
dependencies {
compile group:
implementation group:
'org.springframework', name: 'spring-core', version: '4.3.5.RELEASE'
compile 'org.springframework:spring-core:4.3.5.RELEASE',
implementation 'org.springframework:spring-core:4.3.5.RELEASE',
'org.springframework:spring-aop:4.3.5.RELEASE'
compile(
implementation(
[group: 'org.springframework', name: 'spring-core', version: '4.3.5.RELEASE'],
[group: 'org.springframework', name: 'spring-aop', version: '4.3.5.RELEASE']
)
testCompile('org.hibernate:hibernate-core:5.2.12.Final') {
testImplementation('org.hibernate:hibernate-core:5.2.12.Final') {
transitive = true
}
runtime(group: 'org.hibernate', name: 'hibernate-core', version: '5.2.12.Final') {
runtimeOnly(group: 'org.hibernate', name: 'hibernate-core', version: '5.2.12.Final') {
transitive = false
}
runtime "org.codehaus.groovy:groovy-all:2.4.11@jar"
runtime group: 'org.codehaus.groovy', name: 'groovy-all', version: '2.4.11', ext: 'jar'
compile fileTree(dir: 'libs', include: '*.jar')
runtimeOnly "org.codehaus.groovy:groovy-all:2.4.11@jar"
runtimeOnly group: 'org.codehaus.groovy', name: 'groovy-all', version: '2.4.11', ext: 'jar'
implementation fileTree(dir: 'libs', include: '*.jar')
}

View File

@ -1,2 +0,0 @@
Manifest-Version: 1.0

View File

@ -1,11 +1,11 @@
apply plugin : 'java'
apply plugin : 'application'
dependencies {
compile project(':greeting-library')
compile project(':greeting-library-java')
implementation project(':greeting-library')
implementation project(':greeting-library-java')
implementation group: 'org.codehaus.groovy', name: 'groovy-all', version: '2.4.11', ext: 'jar'
}
mainClassName = 'greeter.Greeter'

View File

@ -1,9 +1,7 @@
apply plugin :'java'
//apply plugin : 'application'
dependencies{
compile group: 'joda-time', name: 'joda-time', version: '2.9.9'
testCompile group: 'junit', name: 'junit', version: '4.12'
implementation group: 'joda-time', name: 'joda-time', version: '2.9.9'
testImplementation group: 'junit', name: 'junit', version: '4.12'
}

View File

@ -1,9 +1,9 @@
apply plugin : 'groovy'
dependencies {
compile 'org.codehaus.groovy:groovy:2.4.12'
implementation 'org.codehaus.groovy:groovy:2.4.12'
testCompile 'org.spockframework:spock-core:1.0-groovy-2.4', {
testImplementation 'org.spockframework:spock-core:1.0-groovy-2.4', {
exclude module : 'groovy-all'
}
}

View File

@ -4,7 +4,5 @@ include 'greeting-library'
include 'greeting-library-java'
include 'greeter'
include 'gradletaskdemo'
include 'gradle-employee-app'
include 'gradle-source-vs-target-compatibility'
println 'This will be executed during the initialization phase.'