Class StartParameter
- All Implemented Interfaces:
- Serializable,- LoggingConfiguration,- ParallelismConfiguration
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:
- 
Field SummaryFields
- 
Constructor SummaryConstructorsModifierConstructorDescriptionCreates aStartParameterwith default values.protectedStartParameter(org.gradle.initialization.BuildLayoutParameters layoutParameters) Creates aStartParameterinitialized from the givenBuildLayoutParameters.
- 
Method SummaryModifier and TypeMethodDescriptionvoidaddInitScript(File initScriptFile) Adds the given file to the list of init scripts that are run before the build starts.booleanReturns all init scripts, including explicit init scripts and implicit init scripts.Deprecated.Setting custom build file to select the default project has been deprecated.Returns the style of logging output that should be written to the console.Returns the directory to use to select the default project, and to search for the settings file.Returns the dependency verification mode.Returns the names of the tasks to be excluded from this build.Returns the directory to use as the user home directory.Returns all explicitly added init scripts that will be run before the build starts.Returns the list of modules that are to be allowed to update their version compared to the lockfile.Returns the minimum logging level to use.intReturns the maximum number of concurrent workers used for underlying build operations.Returns the project's cache dir.Returns the project dir to use to select the default project.Key-value map of project properties.Deprecated.Setting custom build file to select the default project has been deprecated.Returns the detail that should be included in stacktraces.Key-value map of system properties.Returns the names of the tasks to execute in this build.Returns the tasks to execute in this build.Specifies which type of warnings should be written to the console.Returns when to display a welcome message on the command line.Indicates if a dependency verification metadata file should be written at the end of this build.inthashCode()voidincludeBuild(File includedBuild) booleanWhether build cache debug logging is enabled.booleanReturns true if the build cache is enabled.booleanReturns true if project dependencies are to be built, false if they should not be.booleanReturns true if build scan should be created.booleanDeprecated.UseConfiguration Cache build featureinstead.booleanIf the configure-on-demand mode is activebooleanSpecifies whether the build should continue on task failure.booleanbooleanisDryRun()Is the build running as a dry-run? Dry-run means task actions do not execute for the root build.booleanIf true, after writing the dependency verification file, a public keyring file will be generated with all keys seen during generation of the file.booleanReturns true when build scan creation is explicitly disabled.booleanSpecifies whether the build should be performed offline (ie without network access).booleanReturns true if parallel project execution is enabled.booleanReturns true if a profile report will be generated.booleanSpecifies whether the dependencies should be refreshed..booleanIf true, Gradle will try to download missing keys again.booleanSpecifies whether the cached task results should be ignored and each task should be forced to be executed.booleanReturns true when dependency resolution is to be persisted for lockingnewBuild()Creates the parameters for a new build, using these parameters as a template.Duplicates thisStartParameterinstance.protected StartParameterprotected StartParametervoidsetBuildCacheDebugLogging(boolean buildCacheDebugLogging) Whether build cache debug logging is enabled.voidsetBuildCacheEnabled(boolean buildCacheEnabled) Enables/disables the build cache.voidsetBuildFile(File buildFile) Deprecated.Setting custom build file to select the default project has been deprecated.setBuildProjectDependencies(boolean build) Specifies whether project dependencies should be built.voidsetBuildScan(boolean buildScan) Specifies whether a build scan should be created.voidsetConfigureOnDemand(boolean configureOnDemand) voidsetConsoleOutput(ConsoleOutput consoleOutput) Specifies the style of logging output that should be written to the console.voidsetContinueOnFailure(boolean continueOnFailure) Specifies whether the build should continue on task failure.voidsetContinuous(boolean enabled) voidsetCurrentDir(File currentDir) Sets the directory to use to select the default project, and to search for the settings file.voidsetDependencyVerificationMode(DependencyVerificationMode verificationMode) Sets the dependency verification mode.voidsetDryRun(boolean dryRun) Enables or disables dry-run.voidsetExcludedTaskNames(Iterable<String> excludedTaskNames) Sets the tasks to exclude from this build.voidsetExportKeys(boolean exportKeys) If true, after writing the dependency verification file, a public keyring file will be generated with all keys seen during generation of the file.voidsetGradleUserHomeDir(File gradleUserHomeDir) Sets the directory to use as the user home directory.voidsetIncludedBuilds(List<File> includedBuilds) voidsetInitScripts(List<File> initScripts) Sets the list of init scripts to be run before the build starts.voidsetLockedDependenciesToUpdate(List<String> lockedDependenciesToUpdate) Indicates that specified dependencies are to be allowed to update their version.voidsetLogLevel(LogLevel logLevel) Specifies the minimum logging level to use.voidsetMaxWorkerCount(int maxWorkerCount) Specifies the maximum number of concurrent workers used for underlying build operations.voidsetNoBuildScan(boolean noBuildScan) Specifies whether build scan creation is explicitly disabled.voidsetOffline(boolean offline) Specifies whether the build should be performed offline (ie without network access).voidsetParallelProjectExecutionEnabled(boolean parallelProjectExecution) Enables/disables parallel project execution.voidsetProfile(boolean profile) Specifies if a profile report should be generated.voidsetProjectCacheDir(File projectCacheDir) Sets the project's cache location.voidsetProjectDir(File projectDir) Sets the project directory to use to select the default project.voidsetProjectProperties(Map<String, String> projectProperties) Sets the project properties.voidsetRefreshDependencies(boolean refreshDependencies) Specifies whether the dependencies should be refreshed..voidsetRefreshKeys(boolean refresh) Sets the key refresh flag.voidsetRerunTasks(boolean rerunTasks) Specifies whether the cached task results should be ignored and each task should be forced to be executed.voidsetSettingsFile(File settingsFile) Deprecated.Setting custom settings file for the build has been deprecated.voidsetShowStacktrace(ShowStacktrace showStacktrace) Sets the detail that should be included in stacktraces.voidsetSystemPropertiesArgs(Map<String, String> systemPropertiesArgs) Sets the system properties.voidsetTaskNames(Iterable<String> taskNames) Sets the tasks to execute in this build.voidsetTaskRequests(Iterable<? extends TaskExecutionRequest> taskParameters) Sets the task parameters to execute in this build.voidsetWarningMode(WarningMode warningMode) Specifies which type of warnings should be written to the console.voidsetWelcomeMessageConfiguration(WelcomeMessageConfiguration welcomeMessageConfiguration) Updates when to display a welcome message on the command line.voidsetWriteDependencyLocks(boolean writeDependencyLocks) Specifies whether dependency resolution needs to be persisted for lockingvoidsetWriteDependencyVerifications(List<String> checksums) Tells if a dependency verification metadata file should be written at the end of this build.toString()
- 
Field Details- 
GRADLE_USER_HOME_PROPERTY_KEY- See Also:
 
- 
DEFAULT_GRADLE_USER_HOMEThe default user home directory.
- 
gradleHomeDir
 
- 
- 
Constructor Details- 
StartParameterpublic StartParameter()Creates aStartParameterwith default values. This is roughly equivalent to running Gradle on the command-line with no arguments.
- 
StartParameterprotected StartParameter(org.gradle.initialization.BuildLayoutParameters layoutParameters) Creates aStartParameterinitialized from the givenBuildLayoutParameters.- Since:
- 7.0
 
 
- 
- 
Method Details- 
getLogLevelReturns the minimum logging level to use. All log messages with a lower log level are ignored. Defaults toLogLevel.LIFECYCLE.- Specified by:
- getLogLevelin interface- LoggingConfiguration
 
- 
setLogLevelSpecifies the minimum logging level to use. All log messages with a lower log level are ignored.- Specified by:
- setLogLevelin interface- LoggingConfiguration
 
- 
getShowStacktraceReturns the detail that should be included in stacktraces. Defaults toShowStacktrace.INTERNAL_EXCEPTIONS.- Specified by:
- getShowStacktracein interface- LoggingConfiguration
 
- 
setShowStacktraceSets the detail that should be included in stacktraces.- Specified by:
- setShowStacktracein interface- LoggingConfiguration
 
- 
getConsoleOutputReturns the style of logging output that should be written to the console. Defaults toConsoleOutput.Auto- Specified by:
- getConsoleOutputin interface- LoggingConfiguration
 
- 
setConsoleOutputSpecifies the style of logging output that should be written to the console.- Specified by:
- setConsoleOutputin interface- LoggingConfiguration
 
- 
getWarningModeSpecifies which type of warnings should be written to the console.- Specified by:
- getWarningModein interface- LoggingConfiguration
 
- 
setWarningModeSpecifies which type of warnings should be written to the console.- Specified by:
- setWarningModein interface- LoggingConfiguration
 
- 
setProjectCacheDirSets the project's cache location. Set to null to use the default location.
- 
getProjectCacheDirReturns the project's cache dir.Note that this directory is managed by Gradle, and it assumes full ownership of its contents. Plugins and build logic should not store or modify any files or directories within this cache directory. - Returns:
- project's cache dir, or null if the default location is to be used.
 
- 
newInstanceDuplicates thisStartParameterinstance.- Returns:
- the new parameters.
 
- 
prepareNewInstance
- 
newBuildCreates 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.
 
- 
prepareNewBuild
- 
equals
- 
hashCodepublic int hashCode()
- 
getBuildFileDeprecated.Setting custom build file to select the default project has been deprecated. This method will be removed in Gradle 9.0.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.
 
- 
setBuildFileDeprecated.Setting custom build file to select the default project has been deprecated. Please usesetProjectDir(File)to specify the directory of the default project instead. This method will be removed in Gradle 9.0.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.
 
- 
getTaskNamesReturns the names of the tasks to execute in this build. When empty, the default tasks for the project will be executed. IfTaskExecutionRequests 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.
 
- 
setTaskNamesSets 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.
 
- 
getTaskRequestsReturns 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.
 
- 
setTaskRequestsSets 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.
 
- 
getExcludedTaskNamesReturns 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.
 
- 
setExcludedTaskNamesSets the tasks to exclude from this build.- Parameters:
- excludedTaskNames- The task names.
 
- 
getCurrentDirReturns the directory to use to select the default project, and to search for the settings file.- Returns:
- The current directory. Never returns null.
 
- 
setCurrentDirSets 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.
 
- 
getProjectPropertiesKey-value map of project properties. These are derived from the command-line arguments (-P) and do not reflect the final project properties available. Changing these properties may be too late to impact the build configuration.- Returns:
- map of properties
 
- 
setProjectPropertiesSets the project properties. This completely replaces the map of project properties. Changing these properties may be too late to impact the build configuration.- Parameters:
- projectProperties- new map of properties
 
- 
getSystemPropertiesArgsKey-value map of system properties. These are derived from the command-line arguments (-D) and do not reflect the final system properties available. Changing these properties may be too late to impact the build configuration.- Returns:
- map of properties
 
- 
setSystemPropertiesArgsSets the system properties. This completely replaces the map of system properties. Changing these properties may be too late to impact the build configuration.- Parameters:
- systemPropertiesArgs- new map of properties
 
- 
getGradleUserHomeDirReturns the directory to use as the user home directory.- Returns:
- The home directory.
 
- 
setGradleUserHomeDirSets 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.
 
- 
isBuildProjectDependenciespublic boolean isBuildProjectDependencies()Returns true if project dependencies are to be built, false if they should not be. The default is true.
- 
setBuildProjectDependenciesSpecifies whether project dependencies should be built. Defaults to true.- Returns:
- this
 
- 
isDryRunpublic boolean isDryRun()Is the build running as a dry-run? Dry-run means task actions do not execute for the root build.- Returns:
- true if the build is running as a dry-run
 
- 
setDryRunpublic void setDryRun(boolean dryRun) Enables or disables dry-run.- Parameters:
- dryRun- true if the build should run as a dry-run
 
- 
setSettingsFileDeprecated.Setting custom settings file for the build has been deprecated. Please usesetProjectDir(File)to specify the directory of the default project instead. This method will be removed in Gradle 9.0.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.
 
- 
getSettingsFileDeprecated.Setting custom build file to select the default project has been deprecated. This method will be removed in Gradle 9.0.Returns the explicit settings file to use for the build, or null. Will return null if the default settings file is to be used.- Returns:
- The settings file. May be null.
 
- 
addInitScriptAdds 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.
 
- 
setInitScriptsSets 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.
 
- 
getInitScriptsReturns 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.
 
- 
getAllInitScriptsReturns all init scripts, including explicit init scripts and implicit init scripts.- Returns:
- All init scripts, including explicit init scripts and implicit init scripts.
 
- 
setProjectDirSets 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.
 
- 
getProjectDirReturns 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.
 
- 
setProfilepublic void setProfile(boolean profile) Specifies if a profile report should be generated.- Parameters:
- profile- true if a profile report should be generated
 
- 
isProfilepublic boolean isProfile()Returns true if a profile report will be generated.
- 
isContinueOnFailurepublic boolean isContinueOnFailure()Specifies whether the build should continue on task failure. The default is false.
- 
setContinueOnFailurepublic void setContinueOnFailure(boolean continueOnFailure) Specifies whether the build should continue on task failure. The default is false.
- 
isOfflinepublic boolean isOffline()Specifies whether the build should be performed offline (ie without network access).
- 
setOfflinepublic void setOffline(boolean offline) Specifies whether the build should be performed offline (ie without network access).
- 
isRefreshDependenciespublic boolean isRefreshDependencies()Specifies whether the dependencies should be refreshed..
- 
setRefreshDependenciespublic void setRefreshDependencies(boolean refreshDependencies) Specifies whether the dependencies should be refreshed..
- 
isRerunTaskspublic boolean isRerunTasks()Specifies whether the cached task results should be ignored and each task should be forced to be executed.
- 
setRerunTaskspublic void setRerunTasks(boolean rerunTasks) Specifies whether the cached task results should be ignored and each task should be forced to be executed.
- 
isParallelProjectExecutionEnabledpublic boolean isParallelProjectExecutionEnabled()Returns true if parallel project execution is enabled.- Specified by:
- isParallelProjectExecutionEnabledin interface- ParallelismConfiguration
- See Also:
 
- 
setParallelProjectExecutionEnabledpublic void setParallelProjectExecutionEnabled(boolean parallelProjectExecution) Enables/disables parallel project execution.- Specified by:
- setParallelProjectExecutionEnabledin interface- ParallelismConfiguration
- See Also:
 
- 
isBuildCacheEnabledpublic boolean isBuildCacheEnabled()Returns true if the build cache is enabled.- Since:
- 3.5
 
- 
setBuildCacheEnabledpublic void setBuildCacheEnabled(boolean buildCacheEnabled) Enables/disables the build cache.- Since:
- 3.5
 
- 
isBuildCacheDebugLoggingpublic boolean isBuildCacheDebugLogging()Whether build cache debug logging is enabled.- Since:
- 4.6
 
- 
setBuildCacheDebugLoggingpublic void setBuildCacheDebugLogging(boolean buildCacheDebugLogging) Whether build cache debug logging is enabled.- Since:
- 4.6
 
- 
getMaxWorkerCountpublic 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". Some examples:- A thread running a task
- A test process
- A language compiler in a forked process
 - Specified by:
- getMaxWorkerCountin interface- ParallelismConfiguration
- Returns:
- maximum number of concurrent workers, always >= 1.
- See Also:
 
- 
setMaxWorkerCountpublic void setMaxWorkerCount(int maxWorkerCount) Specifies the maximum number of concurrent workers used for underlying build operations.- Specified by:
- setMaxWorkerCountin interface- ParallelismConfiguration
- See Also:
 
- 
isConfigureOnDemandIf the configure-on-demand mode is active
- 
toString
- 
setConfigureOnDemand
- 
isContinuouspublic boolean isContinuous()
- 
setContinuouspublic void setContinuous(boolean enabled) 
- 
includeBuild
- 
setIncludedBuilds
- 
getIncludedBuilds
- 
isBuildScanpublic boolean isBuildScan()Returns true if build scan should be created.- Since:
- 3.4
 
- 
setBuildScanpublic void setBuildScan(boolean buildScan) Specifies whether a build scan should be created.- Since:
- 3.4
 
- 
isNoBuildScanpublic boolean isNoBuildScan()Returns true when build scan creation is explicitly disabled.- Since:
- 3.4
 
- 
setNoBuildScanpublic void setNoBuildScan(boolean noBuildScan) Specifies whether build scan creation is explicitly disabled.- Since:
- 3.4
 
- 
setWriteDependencyLockspublic void setWriteDependencyLocks(boolean writeDependencyLocks) Specifies whether dependency resolution needs to be persisted for locking- Since:
- 4.8
 
- 
isWriteDependencyLockspublic boolean isWriteDependencyLocks()Returns true when dependency resolution is to be persisted for locking- Since:
- 4.8
 
- 
setLockedDependenciesToUpdateIndicates that specified dependencies are to be allowed to update their version. Implicitly activates dependency locking persistence.- Parameters:
- lockedDependenciesToUpdate- the modules to update
- Since:
- 4.8
- See Also:
 
- 
getWriteDependencyVerificationsIndicates if a dependency verification metadata file should be written at the end of this build. If the list is not empty, then it means we need to generate or update the dependency verification file with the checksums specified in the list.- Since:
- 6.1
 
- 
setWriteDependencyVerificationsTells if a dependency verification metadata file should be written at the end of this build.- Parameters:
- checksums- the list of checksums to generate
- Since:
- 6.1
 
- 
getLockedDependenciesToUpdateReturns the list of modules that are to be allowed to update their version compared to the lockfile.- Returns:
- a list of modules allowed to have a version update
- Since:
- 4.8
 
- 
setDependencyVerificationModeSets the dependency verification mode. There are three different modes:- strict, the default, verification is enabled as soon as a dependency verification file is present.
- lenient, in this mode, failure to verify a checksum, missing checksums or signatures will be logged but will not fail the build. This mode should only be used when updating dependencies as it is inherently unsafe.
- off, this mode disables all verifications
 - Parameters:
- verificationMode- the verification mode to use
- Since:
- 6.2
 
- 
getDependencyVerificationModeReturns the dependency verification mode.- Since:
- 6.2
 
- 
setRefreshKeyspublic void setRefreshKeys(boolean refresh) Sets the key refresh flag.- Parameters:
- refresh- If set to true, missing keys will be checked again. By default missing keys are cached for 24 hours.
- Since:
- 6.2
 
- 
isRefreshKeyspublic boolean isRefreshKeys()If true, Gradle will try to download missing keys again.- Since:
- 6.2
 
- 
isExportKeyspublic boolean isExportKeys()If true, after writing the dependency verification file, a public keyring file will be generated with all keys seen during generation of the file. This file can then be used as a source for public keys instead of reaching out public key servers.- Returns:
- true if keys should be exported
- Since:
- 6.2
 
- 
setExportKeyspublic void setExportKeys(boolean exportKeys) If true, after writing the dependency verification file, a public keyring file will be generated with all keys seen during generation of the file. This file can then be used as a source for public keys instead of reaching out public key servers.- Parameters:
- exportKeys- set to true if keys should be exported
- Since:
- 6.2
 
- 
getWelcomeMessageConfigurationReturns when to display a welcome message on the command line.- Returns:
- The welcome message configuration.
- Since:
- 7.5
- See Also:
 
- 
setWelcomeMessageConfiguration@Incubating public void setWelcomeMessageConfiguration(WelcomeMessageConfiguration welcomeMessageConfiguration) Updates when to display a welcome message on the command line.- Parameters:
- welcomeMessageConfiguration- The welcome message configuration.
- Since:
- 7.5
- See Also:
 
- 
isConfigurationCacheRequestedDeprecated.UseConfiguration Cache build featureinstead.Returns true if configuration caching has been requested. Note that the configuration cache may not necessarily be used even when requested, for example it may be disabled due to the presence of configuration cache problems. It is also currently not used during an IDE import/sync.- Since:
- 7.6
 
 
-