Book Image

Gradle Essentials

By : Abhinandan Maheshwari
Book Image

Gradle Essentials

By: Abhinandan Maheshwari

Overview of this book

Gradle is an advanced and modern build automation tool. It inherits the best elements of the past generation of build tools, but it also differs and innovates to bring terseness, elegance, simplicity, and the flexibility to build. Right from installing Gradle and writing your first build file to creating a fully-fledged multi-module project build, this book will guide you through its topics in a step-by-step fashion. You will get your hands dirty with a simple Java project built with Gradle and go on to build web applications that are run with Jetty or Tomcat. We take a unique approach towards explaining the DSL using the Gradle API, which makes the DSL more accessible and intuitive. All in all, this book is a concise guide to help you decipher the Gradle build files, covering the essential topics that are most useful in real-world projects. With every chapter, you will learn a new topic and be able to readily implement your build files.
Table of Contents (17 chapters)
Gradle Essentials
Credits
About the Authors
Acknowledgments
About the Reviewers
www.PacktPub.com
Preface
Index

Generating documentation


Documentation is one of the important part of development life cycle, which does not get enough attention from developers. If code is not properly documented, it always increases the maintenance efforts and also it takes time for the new team member to understand the code, if the code lacks the documentation. When you apply Java plugin to your build file, Gradle provides you a javadoc task. By default, Gradle generates the initial documentation for your code, even if the user does not mention any Javadoc in the file.

Consider the following Java sample code:

package ch6;
public class SampleTask  {
  public static void main(String[] args) {
    System.out.println("Building Project");

  }
  public String greetings(String name) {
    return "hello "+name;
  }
}

Now, try to execute the following command:

> gradle clean javadoc
:clean
:cleanDir
:createDirs
:compileJava
:processResources UP-TO-DATE
:classes
:javadoc

BUILD SUCCESSFUL

Total time: 4.341 secs

This command...