BAEL-1432 (#3743)
* BAEL-1412 add java 8 spring data features * BAEL-21 new HTTP API overview * BAEL-21 fix executor * BAEL-1432 add custom gradle task
This commit is contained in:
parent
d9fddbde78
commit
00f5648b39
|
@ -33,3 +33,60 @@ task execSecondTest {
|
|||
}
|
||||
println 'This will be executed during the configuration phase as well.'
|
||||
}
|
||||
|
||||
task welcome {
|
||||
doLast {
|
||||
println 'Welcome on the Baeldung!'
|
||||
}
|
||||
}
|
||||
|
||||
task welcomeWithGroup {
|
||||
group 'Sample category'
|
||||
doLast {
|
||||
println 'Welcome on the Baeldung!'
|
||||
}
|
||||
}
|
||||
|
||||
task welcomeWithGroupAndDescription {
|
||||
group 'Sample category'
|
||||
description 'Tasks which shows welcome message'
|
||||
doLast {
|
||||
println 'Welcome on the Baeldung!'
|
||||
}
|
||||
}
|
||||
|
||||
class PrintToolVersionTask extends DefaultTask {
|
||||
String tool
|
||||
|
||||
@TaskAction
|
||||
void printToolVersion() {
|
||||
switch (tool) {
|
||||
case 'java':
|
||||
println System.getProperty("java.version")
|
||||
break
|
||||
case 'groovy':
|
||||
println GroovySystem.version
|
||||
break
|
||||
default:
|
||||
throw new IllegalArgumentException("Unknown tool")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
task printJavaVersion(type : PrintToolVersionTask) {
|
||||
tool 'java'
|
||||
}
|
||||
|
||||
task printGroovyVersion(type : PrintToolVersionTask) {
|
||||
tool 'groovy'
|
||||
}
|
||||
|
||||
import com.baeldung.PrintToolVersionBuildSrcTask
|
||||
|
||||
task printJavaVersionBuildSrc(type : PrintToolVersionBuildSrcTask) {
|
||||
tool 'java'
|
||||
}
|
||||
|
||||
task printGroovyVersionBuildSrc(type : PrintToolVersionBuildSrcTask) {
|
||||
tool 'groovy'
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
package com.baeldung
|
||||
|
||||
import org.gradle.api.DefaultTask
|
||||
import org.gradle.api.tasks.TaskAction
|
||||
|
||||
class PrintToolVersionBuildSrcTask extends DefaultTask {
|
||||
String tool
|
||||
|
||||
@TaskAction
|
||||
void printToolVersion() {
|
||||
switch (tool) {
|
||||
case 'java':
|
||||
println System.getProperty("java.version")
|
||||
break
|
||||
case 'groovy':
|
||||
println GroovySystem.version
|
||||
break
|
||||
default:
|
||||
throw new IllegalArgumentException("Unknown tool")
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue