Skip to content

Commit 3433e96

Browse files
committed
feat(core): add spring dependency management plugin for gradle
1 parent 82936de commit 3433e96

File tree

1 file changed

+26
-12
lines changed

1 file changed

+26
-12
lines changed

build.gradle.kts

Lines changed: 26 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,24 @@
11
import com.moowork.gradle.node.NodeExtension
22
import com.moowork.gradle.node.yarn.YarnTask
3+
import io.spring.gradle.dependencymanagement.dsl.DependencyManagementExtension
34
import org.gradle.api.tasks.bundling.Jar
45
import org.gradle.api.tasks.testing.Test
56
import org.gradle.language.jvm.tasks.ProcessResources
67
import org.gradle.testing.jacoco.tasks.JacocoReport
78
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
89

10+
group = "com.shardis"
11+
version = "0.0.4-SNAPSHOT"
12+
913
buildscript {
14+
1015
val kotlinVersion = "1.1.0-beta-38"
1116
val springBootVersion = "1.5.1.RELEASE"
1217
val gradleNodePluginVersion = "1.1.1"
18+
val dependencyManagementVersion = "1.0.0.RELEASE"
19+
20+
extra["kotlinVersion"] = kotlinVersion
21+
extra["springBootVersion"] = springBootVersion
1322

1423
repositories {
1524
mavenCentral()
@@ -18,6 +27,7 @@ buildscript {
1827
}
1928

2029
dependencies {
30+
classpath("io.spring.gradle:dependency-management-plugin:$dependencyManagementVersion")
2131
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion")
2232
classpath("org.springframework.boot:spring-boot-gradle-plugin:$springBootVersion")
2333
classpath("com.moowork.gradle:gradle-node-plugin:$gradleNodePluginVersion")
@@ -27,6 +37,7 @@ buildscript {
2737
}
2838

2939
apply {
40+
plugin("io.spring.dependency-management")
3041
plugin("java")
3142
plugin("kotlin")
3243
plugin("kotlin-kapt")
@@ -37,11 +48,10 @@ apply {
3748
plugin("org.springframework.boot")
3849
plugin("com.moowork.node")
3950
plugin("jacoco")
51+
plugin("idea")
52+
plugin("eclipse")
4053
}
4154

42-
group = "com.shardis"
43-
version = "0.0.4-SNAPSHOT"
44-
4555
repositories {
4656
mavenCentral()
4757
maven { setUrl("http://dl.bintray.com/kotlin/kotlin-eap-1.1") }
@@ -65,7 +75,6 @@ configure<JavaPluginConvention> {
6575
sourceSets.getByName("main").resources.srcDirs("$buildDir/generated/source/kapt/")
6676
}
6777

68-
6978
configure<NodeExtension> {
7079
version = "7.5.0"
7180
yarnVersion = "0.19.1"
@@ -99,13 +108,20 @@ tasks.withType<Test> {
99108
}
100109
}
101110

111+
val kotlinVersion = extra["kotlinVersion"]
112+
val springBootVersion = extra["springBootVersion"]
113+
val jacksonVersion = the<DependencyManagementExtension>().importedProperties["jackson.version"]
114+
val querydslVersion = the<DependencyManagementExtension>().importedProperties["querydsl.version"]
115+
val jjwtVersion = "0.7.0"
116+
val reflectionsVersion = "0.9.10"
102117

103-
dependencies {
118+
configure<DependencyManagementExtension> {
119+
imports {
120+
it.mavenBom("org.springframework.boot:spring-boot-dependencies:$springBootVersion")
121+
}
122+
}
104123

105-
val kotlinVersion = "1.1.0-beta-38"
106-
val jacksonVersion = "2.8.6"
107-
val jjwtVersion = "0.7.0"
108-
val reflectionsVersion = "0.9.10"
124+
dependencies {
109125

110126
configurations.compile.exclude(group = "org.springframework.boot", module = "spring-boot-starter-tomcat")
111127

@@ -152,11 +168,9 @@ task<YarnTask>("ngTest") {
152168
args = listOf("run", "test")
153169
}
154170

155-
tasks.getByName("jacocoTestReport").dependsOn("test")
156-
tasks.getByName("yarn_install").dependsOn("yarnSetup")
157171
tasks.getByName("processResources").dependsOn("ngBuild")
158172
tasks.getByName("test").dependsOn("ngTest")
159-
tasks.getByName("check").finalizedBy("jacocoTestReport")
173+
tasks.getByName("build").dependsOn("jacocoTestReport")
160174
tasks.getByName("clean").doLast {
161175
delete("node_modules")
162176
}

0 commit comments

Comments
 (0)