gradle-init
TLDR
Initialize a new Gradle project interactively
Initialize a project of a specific type
Initialize a project with a specific DSL
Initialize a project with a specific test framework
Initialize a project without interactive prompts
SYNOPSIS
gradle init [options] [project-dir]
PARAMETERS
--type
Project type: basic, java-application, java-library, groovy-library, kotlin-application, kotlin-library, groovy-gradle-plugin, kotlin-gradle-plugin
--dsl
Build script DSL: groovy (default), kotlin
--project-name
Sets the project name
--package
Base package for sources
--test-framework
Testing framework: junit, junit-jupiter, testng, spek2, kotlintest, spock (varies by type)
--project-dir
Target directory (defaults to current)
--stack-management
Dependency management: internal (default), plain
--incubating
Enables incubating features
--help, -h, -?
Shows help
DESCRIPTION
The gradle init command bootstraps a new Gradle-based project using built-in templates. It generates essential files like build.gradle or build.gradle.kts, source directories, settings files, and sample code, saving developers time on manual setup.
This tool supports diverse project types including basic builds, Java/Kotlin applications and libraries, Groovy plugins, and more. Customization occurs via command-line options for DSL (Groovy or Kotlin), package names, test frameworks, and project directories. Run it in an empty folder for best results; it prompts interactively if options are omitted.
Ideal for Java, Kotlin, Groovy, and Scala projects, gradle init integrates seamlessly with Gradle's ecosystem, enabling immediate builds, tests, and dependency management. It's powered by the Init plugin, activated automatically during execution.
CAVEATS
Run in an empty directory to prevent file conflicts; requires Gradle 2.4+ and internet for template downloads if not cached.
EXAMPLES
gradle init --type java-application --dsl groovy
gradle init --type kotlin-library --dsl kotlin --test-framework junit-jupiter
gradle init --project-name myapp --package com.example
INTERACTIVE MODE
Omit options for guided prompts on type, DSL, name, etc.
HISTORY
Introduced in Gradle 2.4 (2015) as an interactive initializer; expanded in 4.6+ with more templates and Kotlin DSL support; now mature with Gradle 8.x focusing on modern JVM ecosystems.
SEE ALSO
gradle(1)


