Package org.gradle.buildinit.tasks

# Class InitBuild

java.lang.Object
org.gradle.api.internal.AbstractTask
org.gradle.api.DefaultTask
org.gradle.buildinit.tasks.InitBuild

All Implemented Interfaces:
  `Comparable<Task>`, `org.gradle.api.internal.DynamicObjectAware`, `org.gradle.api.internal.TaskInternal`, `Named`, `ExtensionAware`, `Task`, `Configurable<Task>`

@DisableCachingByDefault(because="Not worth caching") @UntrackedTask(because="This task will never be up-to-date") public abstract class InitBuild extends DefaultTask
Generates a Gradle project structure.

- ## Nested Class Summary

  ## Nested classes/interfaces inherited from interface org.gradle.api.Named

  `Named.Namer`

- ## Field Summary

  ### Fields inherited from interface org.gradle.api.Task

  `TASK_ACTION, TASK_CONSTRUCTOR_ARGS, TASK_DEPENDS_ON, TASK_DESCRIPTION, TASK_GROUP, TASK_NAME, TASK_OVERWRITE, TASK_TYPE`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `InitBuild()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `abstract Property<Boolean>`
  `getAllowFileOverwrite()`
  Should we allow existing files in the build directory to be overwritten? This property can be set via command-line option '--overwrite'.
  `Provider<List<String>>`
  `getAvailableBuildTypes()`
  `Provider<List<String>>`
  `getAvailableDSLs()`
  Available build script DSLs to be used.
  `Provider<List<String>>`
  `getAvailableTestFrameworks()`
  Available test frameworks.
  `protected abstract org.gradle.buildinit.specs.internal.BuildInitSpecRegistry`
  `getBuildInitSpecRegistry()`
  `abstract Property<Boolean>`
  `getComments()`
  Should clarifying comments be added to files?
  `abstract Property<String>`
  `getDsl()`
  The desired DSL of build scripts to create, defaults to 'kotlin'.
  `(package private) String`
  `getEffectivePackageName(org.gradle.buildinit.plugins.internal.BuildInitializer initializer)`
  `(package private) String`
  `getEffectiveProjectName(org.gradle.api.internal.tasks.userinput.UserQuestions userQuestions, org.gradle.buildinit.plugins.internal.BuildInitializer initializer)`
  `abstract Property<InsecureProtocolOption>`
  `getInsecureProtocol()`
  How to handle insecure (http) URLs used for Maven Repositories.
  `(package private) @Nullable JavaLanguageVersion`
  `getJavaLanguageVersion(org.gradle.api.internal.tasks.userinput.UserQuestions userQuestions, org.gradle.buildinit.plugins.internal.BuildInitializer initializer)`
  `abstract Property<String>`
  `getJavaVersion()`
  Java version to be used by generated Java projects.
  `protected abstract ProjectLayout`
  `getLayout()`
  `protected abstract ObjectFactory`
  `getObjectFactory()`
  `abstract Property<String>`
  `getPackageName()`
  The name of the package to use for generated source.
  `abstract DirectoryProperty`
  `getProjectDirectory()`
  The directory of the generated project, defaults to the directory the project is generated in.
  `org.gradle.buildinit.plugins.internal.ProjectLayoutSetupRegistry`
  `getProjectLayoutRegistry()`
  `abstract Property<String>`
  `getProjectName()`
  The name of the generated project, defaults to the name of the directory the project is generated in.
  `protected abstract ProviderFactory`
  `getProviderFactory()`
  `abstract Property<Boolean>`
  `getSplitProject()`
  Should the build be split into multiple subprojects? This property can be set via the command-line options '--split-project' and '--no-split-project'.
  `abstract Property<String>`
  `getTestFramework()`
  The test framework to be used in the generated project.
  `abstract Property<String>`
  `getType()`
  The desired type of project to generate, such as 'java-application' or 'kotlin-library'.
  `abstract Property<Boolean>`
  `getUseDefaults()`
  Should default values automatically be accepted for options that are not configured explicitly?
  `abstract Property<Boolean>`
  `getUseIncubating()`
  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.
  `protected abstract org.gradle.api.internal.tasks.userinput.UserInputHandler`
  `getUserInputHandler()`
  `void`
  `setDsl(String dsl)`
  Set the build script DSL to be used.
  `void`
  `setPackageName(String packageName)`
  Set the package name.
  `(package private) void`
  `setProjectLayoutRegistry(org.gradle.buildinit.plugins.internal.ProjectLayoutSetupRegistry projectLayoutRegistry)`
  `void`
  `setProjectName(String projectName)`
  Set the project name.
  `void`
  `setTestFramework(@Nullable String testFramework)`
  Set the test framework to be used.
  `void`
  `setType(String type)`
  Set the type of project to generate.
  `void`
  `setupProjectLayout()`

  ### Methods inherited from class org.gradle.api.DefaultTask

  `compareTo, configure, dependsOn, doFirst, doFirst, doFirst, doLast, doLast, doLast, finalizedBy, getActions, getAnt, getDependsOn, getDescription, getDestroyables, getDidWork, getEnabled, getExtensions, getFinalizedBy, getGroup, getInputs, getLocalState, getLogger, getLogging, getMustRunAfter, getName, getOutputs, getPath, getProject, getShouldRunAfter, getState, getTaskDependencies, getTemporaryDir, getTimeout, hasProperty, mustRunAfter, onlyIf, onlyIf, onlyIf, property, setActions, setDependsOn, setDescription, setDidWork, setEnabled, setFinalizedBy, setGroup, setMustRunAfter, setOnlyIf, setOnlyIf, setOnlyIf, setProperty, setShouldRunAfter, shouldRunAfter, usesService`

  ### Methods inherited from class org.gradle.api.internal.AbstractTask

  `acceptServiceReferences, appendParallelSafeAction, doNotTrackState, doNotTrackStateIf, getAsDynamicObject, getIdentityPath, getImpliesSubProjects, getLifecycleDependencies, getOnlyIf, getReasonNotToTrackState, getReasonsNotToTrackState, getReasonTaskIsIncompatibleWithConfigurationCache, getRequiredServices, getServices, getSharedResources, getStandardOutputCapture, getTaskActions, getTaskIdentity, getTemporaryDirFactory, hasTaskActions, injectIntoNewInstance, isCompatibleWithConfigurationCache, isEnabled, isHasCustomActions, notCompatibleWithConfigurationCache, prependParallelSafeAction, restoreOnlyIf, restoreTaskActions, setImpliesSubProjects`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

  ### Methods inherited from interface org.gradle.api.Task

  `doNotTrackState, notCompatibleWithConfigurationCache`

- ## Constructor Details

  - ### InitBuild

    public InitBuild()

- ## Method Details

  - ### getUseDefaults

    @Incubating @Input @Optional public abstract Property<Boolean> getUseDefaults()
    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'.

    Since:
      8.6

  - ### getAllowFileOverwrite

    @Incubating @Input @Optional public abstract Property<Boolean> getAllowFileOverwrite()
    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.
    Since:
      8.9

  - ### getType

    @Input @Optional public abstract Property<String> getType()
    The desired type of project to generate, such as 'java-application' or 'kotlin-library'.

    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 `getAvailableBuildTypes()`.

  - ### setType

    public void setType(String type)
    Set the type of project to generate.

  - ### getSplitProject

    @Input @Optional public abstract Property<Boolean> getSplitProject()
    Should the build be split into multiple subprojects? This property can be set via the command-line options '--split-project' and '--no-split-project'.
    Since:
      6.7

  - ### getDsl

    @Optional @Input public abstract Property<String> getDsl()
    The desired DSL of build scripts to create, defaults to 'kotlin'.
    Since:
      4.5

  - ### setDsl

    public void setDsl(String dsl)
    Set the build script DSL to be used.
    Since:
      4.5

  - ### getUseIncubating

    @Input @Optional public abstract Property<Boolean> getUseIncubating()
    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.
    Since:
      7.3

  - ### getJavaVersion

    @Input @Optional @Incubating public abstract Property<String> getJavaVersion()
    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.
    Returns:
      the java version number supplied by the user
    Since:
      8.5

  - ### getProjectDirectory

    @Internal("Task outcome is decided early and should not rely on comparing file trees") @Incubating public abstract DirectoryProperty getProjectDirectory()
    The directory of the generated project, defaults to the directory the project is generated in.
    Since:
      9.5.0

  - ### getProjectName

    @Input @Optional public abstract Property<String> getProjectName()
    The name of the generated project, defaults to the name of the directory the project is generated in.
    Since:
      5.0

  - ### setProjectName

    public void setProjectName(String projectName)
    Set the project name.
    Since:
      5.0

  - ### getPackageName

    @Input @Optional public abstract Property<String> getPackageName()
    The name of the package to use for generated source.
    Since:
      5.0

  - ### setPackageName

    public void setPackageName(String packageName)
    Set the package name.
    Since:
      5.0

  - ### getTestFramework

    @Input @Optional public abstract Property<String> getTestFramework()
    The test framework to be used in the generated project.

  - ### setTestFramework

    public void setTestFramework(@Nullable String testFramework)
    Set the test framework to be used.

  - ### getInsecureProtocol

    @Input public abstract Property<InsecureProtocolOption> getInsecureProtocol()
    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'.
    Since:
      7.3

  - ### getComments

    @Incubating @Input @Optional public abstract Property<Boolean> getComments()
    Should clarifying comments be added to files?

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

    Since:
      8.7

  - ### getProjectLayoutRegistry

    public org.gradle.buildinit.plugins.internal.ProjectLayoutSetupRegistry getProjectLayoutRegistry()

  - ### setupProjectLayout

    public void setupProjectLayout()

  - ### getJavaLanguageVersion

    @Nullable JavaLanguageVersion getJavaLanguageVersion(org.gradle.api.internal.tasks.userinput.UserQuestions userQuestions, org.gradle.buildinit.plugins.internal.BuildInitializer initializer)

  - ### getEffectiveProjectName

    String getEffectiveProjectName(org.gradle.api.internal.tasks.userinput.UserQuestions userQuestions, org.gradle.buildinit.plugins.internal.BuildInitializer initializer)

  - ### getEffectivePackageName

    String getEffectivePackageName(org.gradle.buildinit.plugins.internal.BuildInitializer initializer)

  - ### getAvailableBuildTypes

    public Provider<List<String>> getAvailableBuildTypes()

  - ### getAvailableDSLs

    public Provider<List<String>> getAvailableDSLs()
    Available build script DSLs to be used.
    Since:
      4.5

  - ### getAvailableTestFrameworks

    public Provider<List<String>> getAvailableTestFrameworks()
    Available test frameworks.

  - ### setProjectLayoutRegistry

    void setProjectLayoutRegistry(org.gradle.buildinit.plugins.internal.ProjectLayoutSetupRegistry projectLayoutRegistry)

  - ### getProviderFactory

    @Inject protected abstract ProviderFactory getProviderFactory()

  - ### getUserInputHandler

    @Inject protected abstract org.gradle.api.internal.tasks.userinput.UserInputHandler getUserInputHandler()

  - ### getLayout

    @Inject protected abstract ProjectLayout getLayout()

  - ### getObjectFactory

    @Inject protected abstract ObjectFactory getObjectFactory()

  - ### getBuildInitSpecRegistry

    @Inject protected abstract org.gradle.buildinit.specs.internal.BuildInitSpecRegistry getBuildInitSpecRegistry()