Package: org.gradle

## [Java] Class StartParameter

- org.gradle.StartParameter

- All Implemented Interfaces and Traits:
    Serializable

      public class StartParameter
      extends org.gradle.logging.LoggingConfiguration

  `StartParameter` defines the configuration used by a Gradle instance to execute a build. The properties of `StartParameter` generally correspond to the command-line options of Gradle.

  You can obtain an instance of a `StartParameter` by either creating a new one, or duplicating an existing one using newInstance or newBuild.

  See Also:
    org.gradle.initialization.GradleLauncher

- - ### Field Summary

    Fields
    Modifiers | Name | Description
    --- | --- | ---
    `static File` | `DEFAULT_GRADLE_USER_HOME` | The default user home directory.
    `static String` | `GRADLE_USER_HOME_PROPERTY_KEY` |

  - ### Constructor Summary

    Constructors
    Constructor and description
    `StartParameter ()` Creates a `StartParameter` with default values.

  - ### Methods Summary

    Methods
    Type | Name and description
    --- | ---
    `void` | `addInitScript(File initScriptFile)` Adds the given file to the list of init scripts that are run before the build starts.
    `boolean` | `equals(Object obj)`
    `List<File>` | `getAllInitScripts()` Returns all init scripts, including explicit init scripts and implicit init scripts.
    `File` | `getBuildFile()` Returns the build file to use to select the default project.
    `File` | `getCurrentDir()` Returns the directory to use to select the default project, and to search for the settings file.
    `Set<String>` | `getExcludedTaskNames()` Returns the names of the tasks to be excluded from this build.
    `File` | `getGradleUserHomeDir()` Returns the directory to use as the user home directory.
    `List<File>` | `getInitScripts()` Returns all explicitly added init scripts that will be run before the build starts.
    `int` | `getMaxWorkerCount()` Returns the maximum number of concurrent workers used for underlying build operations.
    `int` | `getParallelThreadCount()` Returns the number of parallel threads to use for build execution.
    `File` | `getProjectCacheDir()` Returns the project's cache dir.
    `File` | `getProjectDir()` Returns the project dir to use to select the default project.
    `Map<String, String>` | `getProjectProperties()`
    `File` | `getSettingsFile()` Returns the explicit settings file to use for the build, or null.
    `Map<String, String>` | `getSystemPropertiesArgs()`
    `List<String>` | `getTaskNames()` Returns the names of the tasks to execute in this build.
    `List<TaskExecutionRequest>` | `getTaskRequests()` Returns the tasks to execute in this build.
    `int` | `hashCode()`
    `boolean` | `isBuildProjectDependencies()` Returns true if project dependencies are to be built, false if they should not be.
    `boolean` | `isConfigureOnDemand()` If the configure-on-demand mode is active
    `boolean` | `isContinueOnFailure()` Specifies whether the build should continue on task failure.
    `boolean` | `isContinuous()`
    `boolean` | `isDryRun()`
    `boolean` | `isOffline()` Specifies whether the build should be performed offline (ie without network access).
    `boolean` | `isParallelProjectExecutionEnabled()` Returns true if parallel project execution is enabled.
    `boolean` | `isProfile()` Returns true if a profile report will be generated.
    `boolean` | `isRecompileScripts()` Specifies whether the build scripts should be recompiled.
    `boolean` | `isRefreshDependencies()` Specifies whether the dependencies should be refreshed..
    `boolean` | `isRerunTasks()` Specifies whether the cached task results should be ignored and each task should be forced to be executed.
    `boolean` | `isSearchUpwards()`
    `boolean` | `isUseEmptySettings()` Returns whether an empty settings script will be used regardless of whether one exists in the default location.
    `StartParameter` | `newBuild()`
    `StartParameter` | `newInstance()` Duplicates this `StartParameter` instance.
    `protected StartParameter` | `prepareNewBuild(StartParameter p)`
    `protected StartParameter` | `prepareNewInstance(StartParameter p)`
    `void` | `setBuildFile(File buildFile)` Sets the build file to use to select the default project.
    `StartParameter` | `setBuildProjectDependencies(boolean build)` Specifies whether project dependencies should be built.
    `void` | `setConfigureOnDemand(boolean configureOnDemand)`
    `void` | `setContinueOnFailure(boolean continueOnFailure)` Specifies whether the build should continue on task failure.
    `void` | `setContinuous(boolean enabled)`
    `void` | `setCurrentDir(File currentDir)` Sets the directory to use to select the default project, and to search for the settings file.
    `void` | `setDryRun(boolean dryRun)`
    `void` | `setExcludedTaskNames(Iterable<String> excludedTaskNames)` Sets the tasks to exclude from this build.
    `void` | `setGradleUserHomeDir(File gradleUserHomeDir)` Sets the directory to use as the user home directory.
    `void` | `setInitScripts(List<File> initScripts)` Sets the list of init scripts to be run before the build starts.
    `void` | `setMaxWorkerCount(int maxWorkerCount)` Specifies the maximum number of concurrent workers used for underlying build operations.
    `void` | `setOffline(boolean offline)` Specifies whether the build should be performed offline (ie without network access).
    `void` | `setParallelProjectExecutionEnabled(boolean parallelProjectExecution)` Enables/disables parallel project execution.
    `void` | `setParallelThreadCount(int parallelThreadCount)` Specifies the number of parallel threads to use for build execution.
    `void` | `setProfile(boolean profile)` Specifies if a profile report should be generated.
    `void` | `setProjectCacheDir(File projectCacheDir)` Sets the project's cache location.
    `void` | `setProjectDir(File projectDir)` Sets the project directory to use to select the default project.
    `void` | `setProjectProperties(Map<String, String> projectProperties)`
    `void` | `setRecompileScripts(boolean recompileScripts)` Specifies whether the build scripts should be recompiled.
    `void` | `setRefreshDependencies(boolean refreshDependencies)` Specifies whether the dependencies should be refreshed..
    `void` | `setRerunTasks(boolean rerunTasks)` Specifies whether the cached task results should be ignored and each task should be forced to be executed.
    `void` | `setSearchUpwards(boolean searchUpwards)`
    `void` | `setSettingsFile(File settingsFile)` Sets the settings file to use for the build.
    `void` | `setSystemPropertiesArgs(Map<String, String> systemPropertiesArgs)`
    `void` | `setTaskNames(Iterable<String> taskNames)`
    `void` | `setTaskRequests(Iterable<? extends TaskExecutionRequest> taskParameters)`
    `String` | `toString()`
    `StartParameter` | `useEmptySettings()` Specifies that an empty settings script should be used.

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `class org.gradle.logging.LoggingConfiguration` | `org.gradle.logging.LoggingConfiguration#getConsoleOutput(), org.gradle.logging.LoggingConfiguration#getLogLevel(), org.gradle.logging.LoggingConfiguration#isColorOutput(), org.gradle.logging.LoggingConfiguration#setLogLevel(org.gradle.api.logging.LogLevel), org.gradle.logging.LoggingConfiguration#setColorOutput(boolean), org.gradle.logging.LoggingConfiguration#setConsoleOutput(org.gradle.logging.ConsoleOutput), org.gradle.logging.LoggingConfiguration#getShowStacktrace(), org.gradle.logging.LoggingConfiguration#setShowStacktrace(org.gradle.logging.ShowStacktrace), org.gradle.logging.LoggingConfiguration#wait(long, int), org.gradle.logging.LoggingConfiguration#wait(long), org.gradle.logging.LoggingConfiguration#wait(), org.gradle.logging.LoggingConfiguration#equals(java.lang.Object), org.gradle.logging.LoggingConfiguration#toString(), org.gradle.logging.LoggingConfiguration#hashCode(), org.gradle.logging.LoggingConfiguration#getClass(), org.gradle.logging.LoggingConfiguration#notify(), org.gradle.logging.LoggingConfiguration#notifyAll()`
    `class Object` | `wait, wait, wait, equals, toString, hashCode, getClass, notify, notifyAll`

- - ### Field Detail

    - #### public static final File DEFAULT_GRADLE_USER_HOME

      The default user home directory.

    - #### public static final String GRADLE_USER_HOME_PROPERTY_KEY

  - ### Constructor Detail

    - #### public StartParameter()

      Creates a `StartParameter` with default values. This is roughly equivalent to running Gradle on the command-line with no arguments.

  - ### Method Detail

    - #### public void addInitScript(File initScriptFile)

      Adds the given file to the list of init scripts that are run before the build starts. This list is in addition to the default init scripts.

      Parameters:
        `initScriptFile` - The init scripts.

    - #### public boolean equals(Object obj)

    - #### @Incubating public List<File> getAllInitScripts()

      Returns all init scripts, including explicit init scripts and implicit init scripts.

      Returns:
        All init scripts, including explicit init scripts and implicit init scripts.

    - #### public File getBuildFile()

      Returns the build file to use to select the default project. Returns null when the build file is not used to select the default project.

      Returns:
        The build file. May be null.

    - #### public File getCurrentDir()

      Returns the directory to use to select the default project, and to search for the settings file.

      Returns:
        The current directory. Never returns null.

    - #### public Set<String> getExcludedTaskNames()

      Returns the names of the tasks to be excluded from this build. When empty, no tasks are excluded from the build.

      Returns:
        The names of the excluded tasks. Returns an empty set if there are no such tasks.

    - #### public File getGradleUserHomeDir()

      Returns the directory to use as the user home directory.

      Returns:
        The home directory.

    - #### public List<File> getInitScripts()

      Returns all explicitly added init scripts that will be run before the build starts. This list does not contain the user init script located in ${user.home}/.gradle/init.gradle, even though that init script will also be run.

      Returns:
        list of all explicitly added init scripts.

    - #### @Incubating public int getMaxWorkerCount()

      Returns the maximum number of concurrent workers used for underlying build operations. Workers can be threads, processes or whatever Gradle considers a "worker". Defaults to the number of processors available to the Java virtual machine.

      Returns:
        maximum number of concurrent workers, always >= 1.
      See Also:
        Runtime.availableProcessors

    - #### @Deprecated public int getParallelThreadCount()

      Returns the number of parallel threads to use for build execution. <0: Automatically determine the optimal number of executors to use. 0: Do not use parallel execution. >0: Use this many parallel execution threads.

      deprecated:
        Use getMaxWorkerCount or isParallelProjectExecutionEnabled instead.
      See Also:
        getMaxWorkerCount()
        isParallelProjectExecutionEnabled()

    - #### public File getProjectCacheDir()

      Returns the project's cache dir.

      Returns:
        project's cache dir, or null if the default location is to be used.

    - #### public File getProjectDir()

      Returns the project dir to use to select the default project. Returns null when the build file is not used to select the default project

      Returns:
        The project dir. May be null.

    - #### public Map<String, String> getProjectProperties()

    - #### public File getSettingsFile()

      Returns the explicit settings file to use for the build, or null. Will return null if the default settings file is to be used. However, if isUseEmptySettings() returns true, then no settings file at all will be used.

      Returns:
        The settings file. May be null.
      See Also:
        isUseEmptySettings()

    - #### public Map<String, String> getSystemPropertiesArgs()

    - #### public List<String> getTaskNames()

      Returns the names of the tasks to execute in this build. When empty, the default tasks for the project will be executed. If TaskExecutionRequests are set for this build then names from these task parameters are returned.

      Returns:
        the names of the tasks to execute in this build. Never returns null.

    - #### @Incubating public List<TaskExecutionRequest> getTaskRequests()

      Returns the tasks to execute in this build. When empty, the default tasks for the project will be executed.

      Returns:
        the tasks to execute in this build. Never returns null.

    - #### public int hashCode()

    - #### public boolean isBuildProjectDependencies()

      Returns true if project dependencies are to be built, false if they should not be. The default is true.

    - #### @Incubating public boolean isConfigureOnDemand()

      If the configure-on-demand mode is active

    - #### public boolean isContinueOnFailure()

      Specifies whether the build should continue on task failure. The default is false.

    - #### @Incubating public boolean isContinuous()

    - #### public boolean isDryRun()

    - #### public boolean isOffline()

      Specifies whether the build should be performed offline (ie without network access).

    - #### @Incubating public boolean isParallelProjectExecutionEnabled()

      Returns true if parallel project execution is enabled.

      See Also:
        getParallelThreadCount()

    - #### public boolean isProfile()

      Returns true if a profile report will be generated.

    - #### public boolean isRecompileScripts()

      Specifies whether the build scripts should be recompiled.

    - #### public boolean isRefreshDependencies()

      Specifies whether the dependencies should be refreshed..

    - #### public boolean isRerunTasks()

      Specifies whether the cached task results should be ignored and each task should be forced to be executed.

    - #### public boolean isSearchUpwards()

    - #### public boolean isUseEmptySettings()

      Returns whether an empty settings script will be used regardless of whether one exists in the default location.

      Returns:
        Whether to use empty settings or not.

    - #### public StartParameter newBuild()

      Creates the parameters for a new build, using these parameters as a template. Copies the environmental properties from this parameter (eg Gradle user home dir, etc), but does not copy the build specific properties (eg task names).

      Returns:
        The new parameters.

    - #### public StartParameter newInstance()

      Duplicates this `StartParameter` instance.

      Returns:
        the new parameters.

    - #### protected StartParameter prepareNewBuild(StartParameter p)

    - #### protected StartParameter prepareNewInstance(StartParameter p)

    - #### public void setBuildFile(File buildFile)

      Sets the build file to use to select the default project. Use null to disable selecting the default project using the build file.

      Parameters:
        `buildFile` - The build file. May be null.

    - #### public StartParameter setBuildProjectDependencies(boolean build)

      Specifies whether project dependencies should be built. Defaults to true.

      Returns:
        this

    - #### @Incubating public void setConfigureOnDemand(boolean configureOnDemand)

    - #### public void setContinueOnFailure(boolean continueOnFailure)

      Specifies whether the build should continue on task failure. The default is false.

    - #### @Incubating public void setContinuous(boolean enabled)

    - #### public void setCurrentDir(File currentDir)

      Sets the directory to use to select the default project, and to search for the settings file. Set to null to use the default current directory.

      Parameters:
        `currentDir` - The directory. Set to null to use the default.

    - #### public void setDryRun(boolean dryRun)

    - #### public void setExcludedTaskNames(Iterable<String> excludedTaskNames)

      Sets the tasks to exclude from this build.

      Parameters:
        `excludedTaskNames` - The task names. Can be null.

    - #### public void setGradleUserHomeDir(File gradleUserHomeDir)

      Sets the directory to use as the user home directory. Set to null to use the default directory.

      Parameters:
        `gradleUserHomeDir` - The home directory. May be null.

    - #### public void setInitScripts(List<File> initScripts)

      Sets the list of init scripts to be run before the build starts. This list is in addition to the default init scripts.

      Parameters:
        `initScripts` - The init scripts.

    - #### @Incubating public void setMaxWorkerCount(int maxWorkerCount)

      Specifies the maximum number of concurrent workers used for underlying build operations.

      throws:
        IllegalArgumentException if `maxWorkerCount` is < 1
      See Also:
        getMaxWorkerCount()

    - #### public void setOffline(boolean offline)

      Specifies whether the build should be performed offline (ie without network access).

    - #### @Incubating public void setParallelProjectExecutionEnabled(boolean parallelProjectExecution)

      Enables/disables parallel project execution.

      See Also:
        isParallelProjectExecutionEnabled()

    - #### @Deprecated public void setParallelThreadCount(int parallelThreadCount)

      Specifies the number of parallel threads to use for build execution.

      See Also:
        getParallelThreadCount()

    - #### public void setProfile(boolean profile)

      Specifies if a profile report should be generated.

      Parameters:
        `profile` - true if a profile report should be generated

    - #### public void setProjectCacheDir(File projectCacheDir)

      Sets the project's cache location. Set to null to use the default location.

    - #### public void setProjectDir(File projectDir)

      Sets the project directory to use to select the default project. Use null to use the default criteria for selecting the default project.

      Parameters:
        `projectDir` - The project directory. May be null.

    - #### public void setProjectProperties(Map<String, String> projectProperties)

    - #### public void setRecompileScripts(boolean recompileScripts)

      Specifies whether the build scripts should be recompiled.

    - #### public void setRefreshDependencies(boolean refreshDependencies)

      Specifies whether the dependencies should be refreshed..

    - #### public void setRerunTasks(boolean rerunTasks)

      Specifies whether the cached task results should be ignored and each task should be forced to be executed.

    - #### public void setSearchUpwards(boolean searchUpwards)

    - #### public void setSettingsFile(File settingsFile)

      Sets the settings file to use for the build. Use null to use the default settings file.

      Parameters:
        `settingsFile` - The settings file to use. May be null.

    - #### public void setSystemPropertiesArgs(Map<String, String> systemPropertiesArgs)

    - #### public void setTaskNames(Iterable<String> taskNames)

      Sets the tasks to execute in this build. Set to an empty list, or null, to execute the default tasks for the project. The tasks are executed in the order provided, subject to dependency between the tasks.

      Parameters:
        `taskNames` - the names of the tasks to execute in this build.

    - #### @Incubating public void setTaskRequests(Iterable<? extends TaskExecutionRequest> taskParameters)

      Sets the task parameters to execute in this build. Set to an empty list, to execute the default tasks for the project. The tasks are executed in the order provided, subject to dependency between the tasks.

      Parameters:
        `taskParameters` - the tasks to execute in this build.

    - #### @Override public String toString()

    - #### public StartParameter useEmptySettings()

      Specifies that an empty settings script should be used. This means that even if a settings file exists in the conventional location, or has been previously specified by setSettingsFile(java.io.File), it will not be used. If setSettingsFile(java.io.File) is called after this, it will supersede calling this method.

      Returns:
        this