Listed below are some of the stand-alone samples which are included in the Gradle distribution. You can find these samples in the
directory of the distribution.GRADLE_HOME
/samples
Table A.1. Samples included in the distribution
Sample | Description |
announce
|
A project which uses the announce plugin |
application
|
A project which uses the application plugin |
buildDashboard
|
A project which uses the build-dashboard plugin |
codeQuality
|
A project which uses the various code quality plugins. |
customBuildLanguage
|
This sample demonstrates how to add some custom elements to the build DSL. It also demonstrates the use of custom plug-ins to organize build logic. |
customDistribution
|
This sample demonstrates how to create a custom Gradle distribution and use it with the Gradle wrapper. |
customPlugin
|
A set of projects that show how to implement, test, publish and use a custom plugin and task. |
ear/earCustomized/ear
|
Web application ear project with customized contents |
ear/earWithWar
|
Web application ear project |
groovy/customizedLayout
|
Groovy project with a custom source layout |
groovy/mixedJavaAndGroovy
|
Project containing a mix of Java and Groovy source |
groovy/multiproject
|
Build made up of multiple Groovy projects. Also demonstrates how to exclude certain source files, and the use of a custom Groovy AST transformation. |
groovy/quickstart
|
Groovy quickstart sample |
java/base
|
Java base project |
java/customizedLayout
|
Java project with a custom source layout |
java/multiproject
|
This sample demonstrates how an application can be composed using multiple Java projects. |
java/quickstart
|
Java quickstart project |
java/withIntegrationTests
|
This sample demonstrates how to use a source set to add an integration test suite to a Java project. |
javaGradlePlugin
|
This example demonstrates the use of the java gradle plugin development plugin. By applying the plugin, the java plugin is automatically applied as well as the gradleApi() dependency. Furthermore, validations are performed against the plugin metadata during jar execution. |
maven/pomGeneration
|
Demonstrates how to deploy and install to a Maven repository. Also demonstrates how to deploy a javadoc JAR along with the main JAR, how to customize the contents of the generated POM, and how to deploy snapshots and releases to different repositories. |
maven/quickstart
|
Demonstrates how to deploy and install artifacts to a Maven repository. |
osgi
|
A project which builds an OSGi bundle |
scala/customizedLayout
|
Scala project with a custom source layout |
scala/fsc
|
Scala project using the Fast Scala Compiler (fsc). |
scala/mixedJavaAndScala
|
A project containing a mix of Java and Scala source. |
scala/quickstart
|
Scala quickstart project |
scala/zinc
|
Scala project using the Zinc based Scala compiler. |
testing/testReport
|
Generates an HTML test report that includes the test results from all subprojects. |
toolingApi/customModel
|
A sample of how a plugin can expose its own custom tooling model to tooling API clients. |
toolingApi/eclipse
|
An application that uses the tooling API to build the Eclipse model for a project. |
toolingApi/idea
|
An application that uses the tooling API to extract information needed by IntelliJ IDEA. |
toolingApi/model
|
An application that uses the tooling API to build the model for a Gradle build. |
toolingApi/runBuild
|
An application that uses the tooling API to run a Gradle task. |
userguide/distribution
|
A project which uses the distribution plugin |
userguide/javaLibraryDistribution
|
A project which uses the Java library distribution plugin |
webApplication/customized
|
Web application with customized WAR contents. |
webApplication/quickstart
|
Web application quickstart project |
This sample demonstrates how to add some custom elements to the build DSL. It also demonstrates the use of custom plug-ins to organize build logic.
The build is composed of 2 types of projects. The first type of project represents a product, and the second represents a product module. Each product includes one or more product modules, and each product module may be included in multiple products. That is, there is a many-to-many relationship between these products and product modules. For each product, the build produces a ZIP containing the runtime classpath for each product module included in the product. The ZIP also contains some product-specific files.
The custom elements can be seen in the build script for the product projects (for example,
basicEdition/build.gradle
). Notice that the build script uses the
product { }
element. This is a custom element.
The build scripts of each project contain only declarative elements. The bulk of the work is done by 2
custom plug-ins found in buildSrc/src/main/groovy
.
This sample demonstrates how to create a custom Gradle distribution and use it with the Gradle wrapper.
This sample contains the following projects:
The plugin
directory contains the project that implements a custom plugin, and bundles the plugin into a custom
Gradle distribution.
The consumer
directory contains the project that uses the custom distribution.
A set of projects that show how to implement, test, publish and use a custom plugin and task.
This sample contains the following projects:
The plugin
directory contains the project that implements and publishes the plugin.
The consumer
directory contains the project that uses the plugin.
This sample demonstrates how an application can be composed using multiple Java projects.
This build creates a client-server application which is distributed as 2 archives. First, there is a client ZIP which includes an API JAR, which a 3rd party application would compile against, and a client runtime. Then, there is a server WAR which provides a web service.