Class InitBuild

    • Constructor Detail

      • InitBuild

        public InitBuild()
    • Method Detail

      • getUseDefaults

        @Incubating
        @Input
        @Optional
        public abstract Property<java.lang.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<java.lang.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
        public java.lang.String getType()
        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 getAvailableBuildTypes().

      • getSplitProject

        @Input
        @Optional
        public Property<java.lang.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 java.lang.String getDsl()
        The desired DSL of build scripts to create, defaults to 'kotlin'. This property can be set via command-line option '--dsl'.
        Since:
        4.5
      • getUseIncubating

        @Input
        @Optional
        public Property<java.lang.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 Property<java.lang.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
      • getProjectName

        @Input
        public java.lang.String getProjectName()
        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'.
        Since:
        5.0
      • getPackageName

        @Input
        public java.lang.String getPackageName()
        The name of the package to use for generated source. This property can be set via command-line option '--package'.
        Since:
        5.0
      • getTestFramework

        @Nullable
        @Optional
        @Input
        public java.lang.String getTestFramework()
        The test framework to be used in the generated project. This property can be set via command-line option '--test-framework'
      • getInsecureProtocol

        @Input
        public 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<java.lang.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()
      • setType

        public void setType​(java.lang.String type)
      • getAvailableBuildTypes

        public java.util.List<java.lang.String> getAvailableBuildTypes()
      • setDsl

        public void setDsl​(java.lang.String dsl)
        Set the build script DSL to be used.
        Since:
        4.5
      • getAvailableDSLs

        public java.util.List<java.lang.String> getAvailableDSLs()
        Available build script DSLs to be used.
        Since:
        4.5
      • setTestFramework

        public void setTestFramework​(@Nullable
                                     java.lang.String testFramework)
        Set the test framework to be used.
      • getAvailableTestFrameworks

        public java.util.List<java.lang.String> getAvailableTestFrameworks()
        Available test frameworks.
      • setProjectName

        public void setProjectName​(java.lang.String projectName)
        Set the project name.
        Since:
        5.0
      • setPackageName

        public void setPackageName​(java.lang.String packageName)
        Set the package name.
        Since:
        5.0
      • getProviderFactory

        @Inject
        protected abstract ProviderFactory getProviderFactory()
      • getUserInputHandler

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

        @Inject
        protected abstract ProjectLayout getLayout()