Skip to content
Latchkey

gradle init: Usage & Common CI Errors

Scaffold a new Gradle project - or convert a Maven one.

init is the built-in Gradle task that initializes a new project: it generates build scripts, a settings file, and the Gradle Wrapper, and can convert an existing Maven build (when run in a directory with a pom.xml) into Gradle.

What it does

init scaffolds the chosen project type (application, library, basic) and DSL (Kotlin or Groovy), writing build.gradle(.kts), settings.gradle(.kts), and the wrapper. In a Maven directory it offers a pom.xml conversion. It normally prompts interactively.

Common usage

Terminal
gradle init
gradle init --type java-application --dsl kotlin
gradle init --type pom            # convert an existing Maven build

Common error in CI (and the fix)

Symptom: gradle init hangs or fails in CI with no TTY, e.g. waiting on "Select build script DSL". Cause: init is interactive and there is no console to answer prompts. Fix: pass every choice as a flag (--type, --dsl, --test-framework, --project-name, --package) so no prompt is needed, or run with --console=plain; non-interactive runs must supply all options up front.

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →