Skip to content

Commit ffb1fd7

Browse files
committed
Streamline Gradle build scripts: using the Spring Dependency Management Plugin to manage dependencies and versions
Closes gh-111
1 parent 457c6d7 commit ffb1fd7

File tree

10 files changed

+72
-65
lines changed

10 files changed

+72
-65
lines changed

build.gradle

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@ ext {
2323

2424
version = project.projectVersion
2525

26-
apply plugin:'idea'
27-
2826
apply plugin: 'maven-publish'
2927
apply plugin: "io.github.gradle-nexus.publish-plugin"
3028

@@ -83,6 +81,19 @@ subprojects { project->
8381
if (ext.isGrailsPlugin) {
8482
apply plugin: "org.graceframework.grace-plugin"
8583
}
84+
else {
85+
apply plugin: "io.spring.dependency-management"
86+
87+
dependencyManagement {
88+
imports {
89+
mavenBom "org.graceframework:grace-bom:$graceVersion"
90+
}
91+
applyMavenExclusions false
92+
generatedPomCustomization {
93+
enabled = false
94+
}
95+
}
96+
}
8697

8798
java {
8899
toolchain {
@@ -107,16 +118,16 @@ subprojects { project->
107118
documentation "info.picocli:picocli:4.6.3"
108119
documentation "com.github.javaparser:javaparser-core:$javaParserCoreVersion"
109120

110-
testImplementation "org.spockframework:spock-core:$spockVersion", {
121+
testImplementation "org.spockframework:spock-core", {
111122
exclude group: "org.junit.platform", module: "junit-platform-engine"
112123
}
113-
testImplementation "org.apache.groovy:groovy-test-junit5:${groovyVersion}", {
124+
testImplementation "org.apache.groovy:groovy-test-junit5", {
114125
exclude group: "org.junit.platform", module: "junit-platform-launcher"
115126
exclude group: "org.junit.jupiter", module: "junit-jupiter-engine"
116127
}
117-
testImplementation "org.junit.jupiter:junit-jupiter-api:${junitJupiterVersion}"
118-
testImplementation "org.junit.platform:junit-platform-runner:${junitPlatformVersion}"
119-
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:${junitJupiterVersion}"
128+
testImplementation "org.junit.jupiter:junit-jupiter-api"
129+
testImplementation "org.junit.platform:junit-platform-runner"
130+
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine"
120131
}
121132

122133
java {

gradle.properties

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,12 @@
11
projectVersion=6.3.0-SNAPSHOT
22
projectUrl=https://views.graceframework.org
33
assetPipelineVersion=6.3.0-M1
4-
caffeineVersion=3.1.8
54
functionalTestViewsGradleVersion=6.3.0-M1
65
githubSlug=graceframework/grace-views
7-
gormVersion=2023.3.0-M1
8-
gormMongodbVersion=2023.3.0-M1
96
graceVersion=2023.3.0-M2
107
groovyVersion=4.0.26
11-
bytebuddyVersion=1.14.19
12-
jakartaAnnotationVersion=2.1.1
138
jansiVersion=2.4.0
149
javaParserCoreVersion=3.26.4
15-
javassistVersion=3.30.0-GA
16-
junitJupiterVersion=5.10.5
17-
junitPlatformVersion=1.10.5
18-
servletApiVersion=6.0.0
19-
spockVersion=2.3-groovy-4.0
20-
springBootVersion=3.3.10
21-
springDependencyManagementPluginVersion=1.1.7
2210

2311
org.gradle.caching=true
2412
org.gradle.daemon=true

publishing/mavenCentral.gradle

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ ext.pomInfo = {
1111
}
1212
}
1313
delegate.scm {
14-
delegate.url 'https://github.com/graceframework/grace-views/'
15-
delegate.connection 'scm:git:git://github.com/graceframework/grace-views'
16-
delegate.developerConnection 'scm:git:ssh://github.com:graceframework/grace-views'
14+
delegate.url 'https://github.com/graceframework/grace-views'
15+
delegate.connection 'scm:git:git://github.com/graceframework/grace-views.git'
16+
delegate.developerConnection 'scm:git:ssh://github.com:graceframework/grace-views.git'
1717
}
1818
delegate.developers {
1919
delegate.developer {
@@ -33,6 +33,15 @@ publishing {
3333
from components.java
3434
}
3535

36+
versionMapping {
37+
usage('java-api') {
38+
fromResolutionOf('runtimeClasspath')
39+
}
40+
usage('java-runtime') {
41+
fromResolutionResult()
42+
}
43+
}
44+
3645
if (isGrailsPlugin) {
3746
artifact source: "${project.sourceSets.main.groovy.classesDirectory.get()}/META-INF/grails-plugin.xml",
3847
classifier: "plugin",
@@ -42,11 +51,11 @@ publishing {
4251
pom {
4352
name = projectName
4453
description = "Grace Views : $projectName"
45-
}
4654

47-
pom.withXml {
48-
def pomNode = asNode()
49-
pomNode.children().last() + pomInfo
55+
withXml {
56+
def pomNode = asNode()
57+
pomNode.children().last() + pomInfo
58+
}
5059
}
5160
}
5261
}

views-component/build.gradle

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@ group = "org.graceframework.plugins"
22

33
dependencies {
44
api project(":views-core")
5-
api "jakarta.annotation:jakarta.annotation-api:$jakartaAnnotationVersion"
6-
api "org.graceframework:grace-core:$graceVersion", {
5+
api "jakarta.annotation:jakarta.annotation-api"
6+
api "org.graceframework:grace-core", {
77
exclude group: 'org.graceframework', module: 'grace-datastore-core'
88
}
9-
compileOnly "jakarta.servlet:jakarta.servlet-api:$servletApiVersion"
9+
compileOnly "jakarta.servlet:jakarta.servlet-api"
1010

11-
api "org.springframework.boot:spring-boot-autoconfigure:$springBootVersion"
12-
annotationProcessor "org.springframework.boot:spring-boot-autoconfigure-processor:$springBootVersion"
13-
annotationProcessor "org.springframework.boot:spring-boot-configuration-processor:$springBootVersion"
14-
testImplementation "org.graceframework:grace-test-support:$graceVersion"
11+
api "org.springframework.boot:spring-boot-autoconfigure"
12+
annotationProcessor "org.springframework.boot:spring-boot-autoconfigure-processor"
13+
annotationProcessor "org.springframework.boot:spring-boot-configuration-processor"
14+
testImplementation "org.graceframework:grace-test-support"
1515
}

views-core/build.gradle

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
group = "org.graceframework"
22

33
dependencies {
4-
api "org.apache.groovy:groovy:$groovyVersion"
5-
api "org.graceframework:grace-core:$graceVersion", {
4+
api "org.apache.groovy:groovy"
5+
api "org.graceframework:grace-core", {
66
exclude group: 'org.graceframework', module: 'grace-datastore-core'
77
}
8-
api "org.graceframework:grace-encoder:$graceVersion"
9-
api "org.graceframework:grace-web-common:$graceVersion"
10-
api "org.graceframework:grace-web-url-mappings:$graceVersion", {
8+
api "org.graceframework:grace-encoder"
9+
api "org.graceframework:grace-web-common"
10+
api "org.graceframework:grace-web-url-mappings", {
1111
exclude group: 'org.graceframework', module: 'grace-datastore-gorm-validation'
1212
}
13-
api "org.graceframework:grace-plugin-rest:$graceVersion"
14-
api "org.graceframework:grace-datastore-gorm-support:$gormVersion"
15-
api "com.github.ben-manes.caffeine:caffeine:$caffeineVersion"
16-
compileOnly "jakarta.servlet:jakarta.servlet-api:$servletApiVersion"
13+
api "org.graceframework:grace-plugin-rest"
14+
api "org.graceframework:grace-datastore-gorm-support"
15+
api "com.github.ben-manes.caffeine:caffeine"
16+
compileOnly "jakarta.servlet:jakarta.servlet-api"
1717
}

views-gradle/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ group = "org.graceframework.plugins"
77

88
dependencies {
99
compileOnly gradleApi()
10-
api "org.graceframework:grace-gradle-plugin:$graceVersion", {
10+
api "org.graceframework:grace-gradle-plugin", {
1111
exclude group: 'org.graceframework', module: 'grace-shell'
1212
exclude group: 'org.apache.groovy', module: 'groovy-xml'
1313
}

views-json-templates/build.gradle

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ group = "org.graceframework.plugins"
22

33
dependencies {
44
api project(':views-json')
5-
compileOnly "org.graceframework:grace-plugin-rest:$graceVersion"
6-
compileOnly "jakarta.servlet:jakarta.servlet-api:$servletApiVersion"
7-
compileOnly "org.graceframework:grace-datastore-gorm-mongodb:$gormMongodbVersion"
5+
compileOnly "org.graceframework:grace-plugin-rest"
6+
compileOnly "jakarta.servlet:jakarta.servlet-api"
7+
compileOnly "org.graceframework:grace-datastore-gorm-mongodb"
88
}
99

1010
def compileViews = tasks.register("compileViews", JavaExec) {
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
group = "org.graceframework"
22

33
dependencies {
4-
api "org.graceframework:grace-core:$graceVersion", {
4+
api project(":views-json")
5+
api "org.graceframework:grace-core", {
56
exclude group: 'org.graceframework', module: 'grace-datastore-core'
67
}
7-
compileOnly "jakarta.servlet:jakarta.servlet-api:$servletApiVersion"
8+
compileOnly "jakarta.servlet:jakarta.servlet-api"
89

9-
api "org.graceframework:grace-test-support:$graceVersion"
10-
api project(":views-json")
10+
api "org.graceframework:grace-test-support"
1111
}

views-json/build.gradle

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,18 @@ group = "org.graceframework.plugins"
22

33
dependencies {
44
api project(":views-core")
5-
api "jakarta.annotation:jakarta.annotation-api:$jakartaAnnotationVersion"
6-
api "org.graceframework:grace-core:$graceVersion", {
5+
api "jakarta.annotation:jakarta.annotation-api"
6+
api "org.graceframework:grace-core", {
77
exclude group: 'org.graceframework', module: 'grace-datastore-core'
88
}
99

10-
api "org.springframework.boot:spring-boot-autoconfigure:$springBootVersion"
11-
annotationProcessor "org.springframework.boot:spring-boot-autoconfigure-processor:$springBootVersion"
12-
annotationProcessor "org.springframework.boot:spring-boot-configuration-processor:$springBootVersion"
10+
api "org.springframework.boot:spring-boot-autoconfigure"
11+
annotationProcessor "org.springframework.boot:spring-boot-autoconfigure-processor"
12+
annotationProcessor "org.springframework.boot:spring-boot-configuration-processor"
1313

14-
testImplementation "org.graceframework:grace-test-support:$graceVersion"
14+
testImplementation "org.graceframework:grace-test-support"
1515
testImplementation project(":views-json-testing-support")
16-
testImplementation "net.bytebuddy:byte-buddy:$bytebuddyVersion"
17-
testRuntimeOnly "org.javassist:javassist:$javassistVersion"
16+
testImplementation "net.bytebuddy:byte-buddy"
1817
}
1918

2019
jar {

views-markup/build.gradle

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@ group = "org.graceframework.plugins"
22

33
dependencies {
44
api project(":views-core")
5-
api "jakarta.annotation:jakarta.annotation-api:$jakartaAnnotationVersion"
6-
api "org.graceframework:grace-core:$graceVersion"
7-
compileOnly "jakarta.servlet:jakarta.servlet-api:$servletApiVersion"
5+
api "jakarta.annotation:jakarta.annotation-api"
6+
api "org.graceframework:grace-core"
7+
compileOnly "jakarta.servlet:jakarta.servlet-api"
88

9-
api "org.springframework.boot:spring-boot-autoconfigure:$springBootVersion"
10-
annotationProcessor "org.springframework.boot:spring-boot-autoconfigure-processor:$springBootVersion"
11-
annotationProcessor "org.springframework.boot:spring-boot-configuration-processor:$springBootVersion"
9+
api "org.springframework.boot:spring-boot-autoconfigure"
10+
annotationProcessor "org.springframework.boot:spring-boot-autoconfigure-processor"
11+
annotationProcessor "org.springframework.boot:spring-boot-configuration-processor"
1212

13-
testImplementation "org.graceframework:grace-test-support:$graceVersion"
13+
testImplementation "org.graceframework:grace-test-support"
1414
}

0 commit comments

Comments
 (0)