Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Andres Almiray on Gradle

Andres Almiray on Gradle

More Decks by Enterprise Java User Group Austria

Other Decks in Technology

Transcript

  1. Gradle is a build tool designed to take advantage of

    conventions over (not instead) configuration, while staying flexible enough to be customized to the needs of a particular project. In other words, the build tool bends to the project’s will, not the other way around.
  2. Follows the Maven conventions. Expressive : Prefers a DSL for

    describing what needs to be done. Extensible : Has a growing an thriving plugin ecosystem. Productive : Fosters fast and reproducible builds. Convenient : It’s CI friendly (gradle wrapper).
  3. WHY

  4. Caching of task input and outputs Richer, configurable lifecycle The

    Gradle deamon The Gradle wrapper Multi-project builds are hassle free Plugin development is more intuitive Better documentation overall
  5. HOW

  6. . ├── build.gradle ├── pom.xml └── src ├── main │

    └── java │ └── sample │ └── Foo.java └── test └── java └── sample └── FooTest.java
  7. apply plugin: 'java' apply plugin: 'maven-publish' version = '0.0.0-SNAPSHOT' group

    = 'com.acme' repositories { jcenter() } dependencies { testCompile 'junit:junit:4.12' }
  8. plugins { id 'com.github.johnrengelman.shadow' version '1.2.1' } apply plugin: 'java'

    apply plugin: 'application' mainClassName = 'sample.Foo' repositories { jcenter() } dependencies { compile 'commons-lang:commons-lang:2.6' } $ gradle shadowJar
  9. Installable application . ├── bin │ ├── sample │ └──

    sample.bat └── lib ├── commons-lang-2.6.jar └── sample-0.0.0-SNAPSHOT.jar
  10. 1.  Add assembly plugin 2.  Create assembly descriptor 1.  Dist

    option for building the directory structure 2.  Zip option for packing all in a single file 3.  Create launch scripts (for all target platforms!) 4.  Might require custom profiles OR configure the appassembler plugin
  11. apply plugin: 'java' apply plugin: 'application’ mainClassName = 'sample.Foo' repositories

    { jcenter() } dependencies { compile 'commons-lang:commons-lang:2.6' } $ gradle distZip
  12. license versions stats bintray shadow izpack java2html git coveralls asciidoctor

    jbake markdown livereload gretty Nexus watch wuff spawn