Linux command
gradle-init 命令
文本
复制后可按需替换文件名、目录或参数。
常用示例
Create new project interactively
gradle init
Create Java application
gradle init --type java-application
Create with Kotlin DSL
gradle init --type java-application --dsl kotlin
Create library with test framework
gradle init --type java-library --test-framework junit-jupiter
Create Kotlin application
gradle init --type kotlin-application
Create basic empty project
gradle init --type basic
说明
gradle init creates a new Gradle project with a standard directory structure. It can run interactively, prompting for project type, language, and build script DSL, or non-interactively with command-line options. Supported types include applications and libraries for Java, Kotlin, Groovy, Scala, C++, and Swift.
参数
- --type _type_
- Project type: java-application, java-library, kotlin-application, etc.
- --dsl _dsl_
- Build script DSL: groovy or kotlin.
- --test-framework _framework_
- Test framework: junit, junit-jupiter, spock, testng.
- --project-name _name_
- Project name.
- --package _package_
- Source package name.
FAQ
What is the gradle-init command used for?
gradle init creates a new Gradle project with a standard directory structure. It can run interactively, prompting for project type, language, and build script DSL, or non-interactively with command-line options. Supported types include applications and libraries for Java, Kotlin, Groovy, Scala, C++, and Swift.
How do I run a basic gradle-init example?
Run `gradle init` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does --type _type_ do in gradle-init?
Project type: java-application, java-library, kotlin-application, etc.