JavaApplication

API Documentation:JavaApplication

Note: This class is incubating and may change in a future version of Gradle.

Configuration for a Java application, defining how to assemble the application.

An instance of this type is added as a project extension by the Java application plugin under the name 'application'.

apply plugin: 'application'

application {
  mainClassName 'com.foo.bar.FooBar'
}

Properties

PropertyDescription
applicationDefaultJvmArgs
Incubating

Array of string arguments to pass to the JVM when running the application

applicationDistribution
Incubating

The specification of the contents of the distribution.

applicationName
Incubating

The name of the application.

executableDir
Incubating

Directory to place executables in

mainClassName
Incubating

The fully qualified name of the application's main class.

Methods

No methods

Script blocks

No script blocks

Property details

Iterable<String> applicationDefaultJvmArgs

Note: This property is incubating and may change in a future version of Gradle.

Array of string arguments to pass to the JVM when running the application

Default value:
[]

CopySpec applicationDistribution

Note: This property is incubating and may change in a future version of Gradle.

The specification of the contents of the distribution.

Use this CopySpec to include extra files/resource in the application distribution.

apply plugin: 'application'

applicationDistribution.from("some/dir") {
  include "*.txt"
}

Note that the application plugin pre configures this spec to; include the contents of "src/dist", copy the application start scripts into the "bin" directory, and copy the built jar and its dependencies into the "lib" directory.

Default value:
A copy spec that includes all of the contents of src/dist, copies the start scripts into bin, and copies the built jar and all dependencies into lib

String applicationName

Note: This property is incubating and may change in a future version of Gradle.

The name of the application.

Default value:
project.name

String executableDir

Note: This property is incubating and may change in a future version of Gradle.

Directory to place executables in

Default value:
"bin"

String mainClassName

Note: This property is incubating and may change in a future version of Gradle.

The fully qualified name of the application's main class.

Default value:
null