@Deprecated public abstract class GradleLauncher extends Object
Executes a Gradle build.
GradleLauncher
is deprecated. It has been replaced by the Tooling API.
If you're interested in embedding Gradle you should read the user guide chapter on embedding Gradle.
The main entry point to the Tooling API (and embedding Gradle) is org.gradle.tooling.GradleConnector
.
You should try using the Tooling API (via GradleConnector
) instead of GradleLauncher
.
However, if you need some capability that isn't yet implemented in the Tooling API here is how you use GradleLauncher
:
StartParameter
instance and configure it with the desired properties. The properties
of StartParameter
generally correspond to the command-line options of Gradle. You can use createStartParameter(String...)
to create a StartParameter
from a set of command-line options.GradleLauncher
instance by calling newInstance(org.gradle.StartParameter)
, passing in the StartParameter
,
or an array of Strings that will be treated as command line arguments.GradleLauncher
.run()
to execute the build. This will return a BuildResult
. Note that if the build fails, the
resulting exception will be contained in the BuildResult
.BuildResult.rethrowFailure()
to rethrow any build
failure.Constructor and Description |
---|
GradleLauncher()
Deprecated.
|
Modifier and Type | Method and Description |
---|---|
abstract void |
addListener(Object listener)
Deprecated.
Adds a listener to this build instance.
|
abstract void |
addStandardErrorListener(StandardOutputListener listener)
Deprecated.
Adds a
StandardOutputListener to this build instance. |
abstract void |
addStandardOutputListener(StandardOutputListener listener)
Deprecated.
Adds a
StandardOutputListener to this build instance. |
static StartParameter |
createStartParameter(String... commandLineArgs)
Deprecated.
No replacement.
|
abstract BuildResult |
getBuildAnalysis()
Deprecated.
Evaluates the settings and all the projects.
|
abstract BuildResult |
getBuildAndRunAnalysis()
Deprecated.
Evaluates the settings and all the projects.
|
static org.gradle.initialization.GradleLauncherFactory |
getFactory()
Deprecated.
|
abstract StartParameter |
getStartParameter()
Deprecated.
Returns the
StartParameter used by this build instance. |
static void |
injectCustomFactory(org.gradle.initialization.GradleLauncherFactory gradleLauncherFactory)
Deprecated.
|
static GradleLauncher |
newInstance(StartParameter startParameter)
Deprecated.
Use the tooling API instead.
|
static GradleLauncher |
newInstance(String... commandLineArgs)
Deprecated.
Use the tooling API instead.
|
abstract BuildResult |
run()
Deprecated.
Executes the build for this
GradleLauncher instance and returns the result. |
abstract void |
useLogger(Object logger)
Deprecated.
Use the given listener.
|
public abstract BuildResult run()
Executes the build for this GradleLauncher
instance and returns the result. Note that when the build
fails, the exception is available using BuildResult.getFailure()
.
public abstract BuildResult getBuildAnalysis()
Gradle.getRootProject()
object.public abstract BuildResult getBuildAndRunAnalysis()
Gradle.getRootProject()
object. Fills the execution plan without running
the build. The tasks to be executed tasks are available via Gradle.getTaskGraph()
.@Deprecated public static GradleLauncher newInstance(StartParameter startParameter)
GradleLauncher
instance based on the passed start parameter.startParameter
- The start parameter object the GradleLauncher instance is initialized withGradleLauncher
. Never returns null.@Deprecated public static org.gradle.initialization.GradleLauncherFactory getFactory()
@Deprecated public static GradleLauncher newInstance(String... commandLineArgs)
GradleLauncher
instance based on the passed command line syntax arguments.commandLineArgs
- A String array where each element denotes an entry of the Gradle command line syntaxGradleLauncher
. Never returns null.@Deprecated public static StartParameter createStartParameter(String... commandLineArgs)
StartParameter
object out of command line syntax arguments. Each command line option has an
associated field in the StartParameter
object.commandLineArgs
- A String array where each element denotes an entry of the Gradle command line syntaxGradleLauncher
. Never returns null.@Deprecated public static void injectCustomFactory(org.gradle.initialization.GradleLauncherFactory gradleLauncherFactory)
public abstract void addListener(Object listener)
Adds a listener to this build instance. The listener is notified of events which occur during the execution of
the build. See Gradle.addListener(Object)
for supported listener types.
listener
- The listener to add. Has no effect if the listener has already been added.public abstract void useLogger(Object logger)
Gradle.useLogger(Object)
for details.logger
- The logger to use.public abstract void addStandardOutputListener(StandardOutputListener listener)
Adds a StandardOutputListener
to this build instance. The listener is notified of any text written to
standard output by Gradle's logging system
listener
- The listener to add. Has no effect if the listener has already been added.public abstract void addStandardErrorListener(StandardOutputListener listener)
Adds a StandardOutputListener
to this build instance. The listener is notified of any text written to standard error by Gradle's logging system
listener
- The listener to add. Has no effect if the listener has already been added.public abstract StartParameter getStartParameter()
StartParameter
used by this build instance.