CLI options
- execute only test case of nested subclass
$ ./gradlew test --tests "some.package.class\$subclass"
- specify args
$ ./gradlew run --args="-h"
Modify JVM options
Use Gradle Properties. e.g.
org.gradle.jvmargs=-Xmx1024m -XX:MaxMetaspaceSize=256m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
Global configurations
- parallelize build by default
Set org.gradle.parallel
property on gradle.properties file.
org.gradle.parallel=true
- Enable the configuration cache
Set org.gradle.configuratino-cache
property on gradle.properties file.
org.gradle.configuration-cache=true
Dependencies
Platforms
Platforms are used to ensure that all dependencies in a project align with a consistent set of versions.
BOMs can be imported by platforms.
Debug
Gradle provides the built-in dependencyInsight task to render a dependency insight report from the command line. Dependency insights provide information about a single dependency within a single configuration. Given a dependency, you can identify the selection reason and origin.
Features
Using Plugins
Plugins DSL is newer and convenient way to declare plugin dependencies. It looks up Gradle plugin portal for core and community plugins. If plugins DSL cannot be used due to the restrictions, you need to use Legacy Plugin Application.
Initialization Scripts
It should be added by type. e.g.
import bloop.integrations.gradle.BloopPlugin
initscript {
repositories {
mavenCentral()
}
dependencies { classpath("ch.epfl.scala:gradle-bloop_2.12:1.6.0") }
}
allprojects {
apply<BloopPlugin>()
}
Use .init.gradle.kts
extension for init scripts