Gradle

Gradle
Developer(s) Hans Dockter, Adam Murdoch, Szczepan Faber, Peter Niederwieser, Luke Daley, Rene Gröschke, Daz DeBoer, Steve Appling
Initial release 2007 (2007)
Stable release 2.13[1] / April 25, 2016 (2016-04-25)
Development status Active
Written in Java, Groovy
Operating system Cross-platform
Type Build Tool
License Apache License 2.0
Website www.gradle.org

Gradle is an open source build automation system that builds upon the concepts of Apache Ant and Apache Maven and introduces a Groovy-based domain-specific language (DSL) instead of the XML form used by Apache Maven of declaring the project configuration.[2] Gradle uses a directed acyclic graph ("DAG") to determine the order in which tasks can be run.

Gradle was designed for multi-project builds which can grow to be quite large, and supports incremental builds by intelligently determining which parts of the build tree are up-to-date, so that any task dependent upon those parts will not need to be re-executed.

The initial plugins are primarily focused around Java,[3] Groovy and Scala development and deployment, but more languages and project workflows are on the roadmap.

Example Java project

Consider the case where the Maven directory structure is used for Java sources and resources. These directories are: src/main/java, src/main/resources, src/test/java and src/test/resources.

build.gradle

apply plugin: 'java'

Running gradle build will result in

> gradle build
:compileJava
:processResources
:classes
:jar
:assemble
:compileTestJava
:processTestResources
:testClasses
:test
:check
:build

BUILD SUCCESSFUL

The Java plugin emulates many of the expected Maven lifecycles as tasks in the directed acyclic graph of dependencies for the inputs and outputs of each task. For this simple case, the build task depends upon the outputs of the check and assemble tasks. Likewise, check depends upon test, and assemble depends upon jar.

For projects that do not follow the Maven conventions, Gradle allows the directory structure to be configured. The following example would support a project that contains source files in src/java rather than the src/main/java convention enforced by Maven.

build.gradle

apply plugin: 'java'
sourceSets.main.java.srcDirs = ['src/java']

Example Ant migration

Gradle has a very tight integration with Ant, and even treats Ant build files as scripts that could be directly imported while building. The example below shows a simplistic Ant target being incorporated as a Gradle task.

build.xml

<project>
  <target name="ant.target">
    <echo message="Running ant.target!"/>
  </target>
</project>

build.gradle

ant.importBuild 'build.xml'

Running gradle ant.target will result in

> gradle ant.target
:ant.target
[ant:echo] Running ant.target!

BUILD SUCCESSFUL

Version history

Version Date
0.7 2009-07-20
0.8 2009-09-28
0.9 2010-12-19
1.0 2012-06-12
1.1 2012-07-31
1.2 2012-09-12
1.3 2012-11-20
1.4 2013-01-28
1.5 2013-03-27
1.6 2013-05-07
1.7 2013-08-06
1.8 2013-09-24
1.9 2013-11-19
1.10 2013-12-17
1.11 2014-02-11
1.12 2014-04-29
2.0 2014-07-01 [4]
2.1 2014-09-08 [5]
2.2 2014-11-10 [6]
2.3 2015-02-16 [7]
2.4 2015-05-05 [8]
2.5 2015-07-08 [9]
2.6 2015-08-10 [10]
2.7 2015-09-14 [11]
2.8 2015-10-19 [12]
2.9 2015-11-17 [13]
2.10 2015-12-21 [14]
2.11 2016-02-08 [15]
2.12 2016-03-14 [16]
2.13 2016-04-25 [17]

Past versions are available from Gradle's download page.

See also

References

  1. "Download Gradle l Open Source Enterprise Build Automation". Gradle.org. 2016-04-25. Retrieved 2016-04-25.
  2. "Getting Started With Gradle". Petri Kainulainen. Retrieved 26 March 2016.
  3. "Getting Started · Building Java Projects with Gradle". Retrieved 26 March 2016.
  4. "Gradle 2.0 released - Old Forum - Gradle Forums". Discuss.gradle.org. Retrieved 2016-03-26.
  5. "Gradle 2.1 released - Old Forum - Gradle Forums". Discuss.gradle.org. Retrieved 2016-03-26.
  6. "Gradle 2.2 released - Old Forum - Gradle Forums". Discuss.gradle.org. Retrieved 2016-03-26.
  7. "Gradle 2.3 released - Old Forum - Gradle Forums". Discuss.gradle.org. Retrieved 2016-03-26.
  8. "Gradle 2.4 released - News - Gradle Forums". Discuss.gradle.org. Retrieved 2016-03-26.
  9. "Gradle 2.5 released - News - Gradle Forums". Discuss.gradle.org. Retrieved 2016-03-26.
  10. "Gradle 2.6 released - News - Gradle Forums". Discuss.gradle.org. Retrieved 2016-03-26.
  11. "Gradle 2.7 released - News - Gradle Forums". Discuss.gradle.org. Retrieved 2016-03-26.
  12. "Gradle 2.8 released - News - Gradle Forums". Discuss.gradle.org. Retrieved 2016-03-26.
  13. "Gradle 2.9 released - News - Gradle Forums". Discuss.gradle.org. Retrieved 2016-03-26.
  14. "Gradle 2.10 released - News - Gradle Forums". Discuss.gradle.org. Retrieved 2016-03-26.
  15. "Gradle 2.11 released - News - Gradle Forums". Discuss.gradle.org. Retrieved 2016-03-26.
  16. "Gradle 2.12 released - News - Gradle Forums". Discuss.gradle.org. Retrieved 2016-03-26.
  17. "Gradle 2.13 released - News - Gradle Forums". Discuss.gradle.org. Retrieved 2016-04-25.

Bibliography

External links

This article is issued from Wikipedia - version of the Tuesday, April 26, 2016. The text is available under the Creative Commons Attribution/Share Alike but additional terms may apply for the media files.