The version catalog in Gradle is very useful to have one place in our project to define our project and plugin dependencies with their versions. But we can also use it to define our project version and then refer to that version from the version catalog in our build script file. That way the version catalog is our one place to look for everything related to a version. In the version catalog we have a versions
section and there we can define a key with a version value. The name of the key could be our project or application name for example. We can use type safe accessors generated by Gradle in our build script to refer to that version.
Continue reading →
The JVM Test Suite plugin adds an extension to our build that allows us to configure test tasks. We always can access the default test
task and for example specify the test framework we want to use. Gradle will then automatically add the dependencies of that test framework to the testImplementation
configuration. If we want to add more dependencies to the testImplementation
configuration we don’t have to do that by explicitly mentioning the testImplementation
configuration. Instead we can also use a dependencies
block from within the JvmTestSuite
extension. Any extra dependencies we need to run our tests can be added using the configuration names without a test
prefix. Gradle will automatically add them to the correct test configuration for us so the dependencies are available when we compile and run our tests. This will also work for any other new test type we add to the test suites, e.g. for integration tests.
Continue reading →
In a previous post we learned we can turn a string into a string with kebab casing using dasherize
from the dw::core::Strings
module. If we want to turn a string into a string with camel casing we can use the underscore
function. The underscore
function will replace spaces, dashes and camel-casing with underscores, which makes the result snake-casing. Any uppercase characters are transformed to lowercase characters.
Continue reading →