Skip to content

Commit

Permalink
fix(build): Cleanup dependency management (#273)
Browse files Browse the repository at this point in the history
* fix(build): Cleanup dependency management

All dependencies were declared with the api scope which is not necessary and which leaks dependencies to downstream projects. After this change it should no longer be necessary for Grails apps to force the version of groovy-xml. Several unused dependencies have also been removed.

* chore(build): Add direct dependencies that are used in project

Project depends on grails-bootstrap and grails-gradle-model.
These were previously transitive dependencies pulled in by grails-shell
but as classes from them are used in the project they should be declared.
  • Loading branch information
matrei committed Jan 26, 2024
1 parent 28807aa commit 42ba793
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 42 deletions.
53 changes: 12 additions & 41 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
buildscript {
repositories {
maven { url "https://repo.grails.org/grails/core" }
maven { url "https://plugins.gradle.org/m2/" }
gradlePluginPortal()
}
dependencies {
classpath "io.github.gradle-nexus:publish-plugin:1.3.0"
classpath "com.bmuschko:gradle-nexus-plugin:2.3.1"
}
}

Expand Down Expand Up @@ -69,51 +67,25 @@ if (isReleaseVersion) {
sourceCompatibility = "1.11"
targetCompatibility = "1.11"

configurations {
documentation
}

java {
withJavadocJar()
withSourcesJar()
}

configurations {
all {
resolutionStrategy.force 'org.codehaus.groovy:groovy-xml:3.0.13'
}
configurations.configureEach {
// This is a workaround for grails-shell exposing a different version of Groovy
// than the one used by Gradle. This causes issues with the Groovy compiler.
resolutionStrategy.force "org.codehaus.groovy:groovy-xml:$GroovySystem.version"
}

dependencies {
documentation "org.fusesource.jansi:jansi:2.4.1"
documentation "org.codehaus.groovy:groovy-cli-picocli:$groovyVersion"

api gradleApi()
api "io.github.gradle-nexus:publish-plugin:1.3.0"
api "com.bmuschko:gradle-nexus-plugin:2.3.1"
api "org.grails:grails-gradle-model:$grailsVersion"
api "org.grails:grails-shell:$grailsVersion", {
exclude group: "org.slf4j", module: "slf4j-simple"
}
api "org.grails:grails-bootstrap:$grailsVersion", {
exclude group: "org.fusesource.jansi", module: "jansi"
exclude group: "jline", module: "jline"
exclude group: "net.java.dev.jna", module: "jna"

// Ant
exclude group: "org.codehaus.groovy", module: "groovy-ant"
exclude group: "org.apache.ant", module: "ant"
exclude group: "org.apache.ant", module: "ant-launcher"
exclude group: "org.apache.ivy", module: "ivy"
exclude group: "org.apache.ant", module: "ant-trax"
exclude group: "org.apache.ant", module: "ant-junit"

exclude group: "org.codehaus.gant", module: "gant_groovy1.8"
}

api "org.springframework.boot:spring-boot-gradle-plugin:$springBootVersion"
api "io.spring.gradle:dependency-management-plugin:1.1.4"
api "com.netflix.nebula:gradle-extra-configurations-plugin:7.0.0"
implementation "io.github.gradle-nexus:publish-plugin:1.3.0"
implementation "com.bmuschko:gradle-nexus-plugin:2.3.1"
implementation "org.grails:grails-bootstrap:$grailsVersion"
implementation "org.grails:grails-gradle-model:$grailsVersion"
implementation "org.grails:grails-shell:$grailsVersion"
implementation "org.springframework.boot:spring-boot-gradle-plugin:$springBootVersion"
implementation "io.spring.gradle:dependency-management-plugin:1.1.4"
}

gradlePlugin {
Expand Down Expand Up @@ -191,7 +163,6 @@ configure([compileJava, compileTestJava]) {

configure([groovydoc]) {
destinationDir = project.file("build/docs/api")
classpath += configurations.documentation
}

configure([javadoc]) {
Expand Down
1 change: 0 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
projectVersion=6.1.2-SNAPSHOT
grailsVersion=6.1.1
springBootVersion=2.7.18
groovyVersion=3.0.11

org.gradle.caching=true
org.gradle.daemon=true
Expand Down

0 comments on commit 42ba793

Please sign in to comment.