Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace dependency version variables with lib declaration #731

Open
Bukama opened this issue Apr 20, 2023 · 0 comments
Open

Replace dependency version variables with lib declaration #731

Bukama opened this issue Apr 20, 2023 · 0 comments

Comments

@Bukama
Copy link
Member

Bukama commented Apr 20, 2023

On this weeks JUG event I learned that Gradle has an equivalent to Mavens dependency management, which remind me to last week, where @nipafx was replacing some duplicate version definitions with versions variables.

In Gradle you can do the following (example taken from the Gradle version catalog documentation):

Defining a version catalog for libraries in settings.gradle(.kts)

dependencyResolutionManagement {
    versionCatalogs {
        create("libs") {
            library("groovy-core", "org.codehaus.groovy:groovy:3.0.5")
            library("groovy-json", "org.codehaus.groovy:groovy-json:3.0.5")
            library("groovy-nio", "org.codehaus.groovy:groovy-nio:3.0.5")
            library("commons-lang3", "org.apache.commons", "commons-lang3").version {
                strictly("[3.8, 4.0[")
                prefer("3.9")
            }
        }
    }
}

and then just a a lib(xx) call in the build file:

dependencies {
    implementation(libs.groovy.core)
}

With this we could replace our version variables with this catalog so that all our dependencies in the build file would look like the current JUnit dependencies which versions are defined in the correlated BOM. example:

	implementation(group = "org.junit.jupiter", name = "junit-jupiter-api")
	implementation(group = "org.junit.jupiter", name = "junit-jupiter-params")
	implementation(group = "org.junit.platform", name = "junit-platform-launcher")

But I think we need to discuss if we want to move the version definition away from the build file into the settings, esp. as the JUnit BOM version comes from the build pipeline. On the other hand we would replace the current mixture of version strings (for those dependencies we use multiple times) and hard coded versions, e.g. this section

	testImplementation(group = "org.assertj", name = "assertj-core", version = assertjVersion)
	testImplementation(group = "org.mockito", name = "mockito-core", version = "4.11.0")
	testImplementation(group = "com.google.jimfs", name = "jimfs", version = jimfsVersion)
	testImplementation(group = "nl.jqno.equalsverifier", name = "equalsverifier", version = "3.14.1")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant