InitBuild

API Documentation:InitBuild

Generates a Gradle project structure.

Properties

PropertyDescription
allowFileOverwrite
Incubating

Should we allow existing files in the build directory to be overwritten? This property can be set via command-line option '--overwrite'. Defaults to false.

comments
Incubating

Should clarifying comments be added to files?

dsl

The desired DSL of build scripts to create, defaults to 'kotlin'. This property can be set via command-line option '--dsl'.

insecureProtocol

How to handle insecure (http) URLs used for Maven Repositories. This property can be set via command-line option '--insecure-protocol'. The default value is 'warn'.

javaVersion
Incubating

Java version to be used by generated Java projects. When set, Gradle will use the provided value as the target major Java version for all relevant generated projects. Gradle will validate the number to ensure it is a valid and supported major version.

packageName

The name of the package to use for generated source. This property can be set via command-line option '--package'.

projectName

The name of the generated project, defaults to the name of the directory the project is generated in. This property can be set via command-line option '--project-name'.

splitProject

Should the build be split into multiple subprojects? This property can be set via the command-line options '--split-project' and '--no-split-project'.

testFramework

The test framework to be used in the generated project. This property can be set via command-line option '--test-framework'

type

The desired type of project to generate, such as 'java-application' or 'kotlin-library'.

useDefaults
Incubating

Should default values automatically be accepted for options that are not configured explicitly?

useIncubating

Can the generated build use new and unstable features? When enabled, the generated build will use new patterns, APIs or features that may be unstable between minor releases. Use this if you'd like to try out the latest features of Gradle. By default, init will generate a build that uses stable features and behavior.

Methods

No methods

Script blocks

No script blocks

Property details

Property<Boolean> allowFileOverwrite

Note: This property is incubating and may change in a future version of Gradle.

Should we allow existing files in the build directory to be overwritten? This property can be set via command-line option '--overwrite'. Defaults to false.

Default:
defaults to 'false'

Property<Boolean> comments

Note: This property is incubating and may change in a future version of Gradle.

Should clarifying comments be added to files?

This property can be set via the command-line options '--comments' and '--no-comments'.

Default:
true

String dsl

The desired DSL of build scripts to create, defaults to 'kotlin'. This property can be set via command-line option '--dsl'.

Default:
defaults to 'groovy'

How to handle insecure (http) URLs used for Maven Repositories. This property can be set via command-line option '--insecure-protocol'. The default value is 'warn'.

Default:
defaults to 'warn'

Property<String> javaVersion

Note: This property is incubating and may change in a future version of Gradle.

Java version to be used by generated Java projects. When set, Gradle will use the provided value as the target major Java version for all relevant generated projects. Gradle will validate the number to ensure it is a valid and supported major version.

Default:
the Java version running Gradle

String packageName

The name of the package to use for generated source. This property can be set via command-line option '--package'.

String projectName

The name of the generated project, defaults to the name of the directory the project is generated in. This property can be set via command-line option '--project-name'.

Default:
defaults to project directory name

Property<Boolean> splitProject

Should the build be split into multiple subprojects? This property can be set via the command-line options '--split-project' and '--no-split-project'.

String testFramework

The test framework to be used in the generated project. This property can be set via command-line option '--test-framework'

Default:
empty (default test framework depends on the requested type)

String type

The desired type of project to generate, such as 'java-application' or 'kotlin-library'.

This property can be set via command-line option '--type'.

Defaults to 'basic' - a minimal scaffolding, following Gradle best practices. If a `pom.xml` is found in the project root directory, the type defaults to 'pom' and the existing project is converted to Gradle.

Possible values for the option are provided by InitBuild.getAvailableBuildTypes().

Default:
empty (or pom if a pom.xml file exists in the project directory)

Property<Boolean> useDefaults

Note: This property is incubating and may change in a future version of Gradle.

Should default values automatically be accepted for options that are not configured explicitly?

When true, the interactive dialog is skipped, and no user input is required to complete the command.

This property can be set via the command-line options '--use-defaults' and '--no-use-defaults'.

Default:
false

Property<Boolean> useIncubating

Can the generated build use new and unstable features? When enabled, the generated build will use new patterns, APIs or features that may be unstable between minor releases. Use this if you'd like to try out the latest features of Gradle. By default, init will generate a build that uses stable features and behavior.

Default:
defaults to 'false'