You are previewing Building and Testing with Gradle.

Building and Testing with Gradle

Cover of Building and Testing with Gradle by Tim Berglund... Published by O'Reilly Media, Inc.
  1. Building and Testing with Gradle
  2. Dedication
  3. SPECIAL OFFER: Upgrade this ebook with O’Reilly
  4. Foreword
  5. Preface
    1. Introduction
    2. Conventions Used in This Book
    3. Using Code Examples
    4. Safari® Books Online
    5. How to Contact Us
    6. Acknowledgments from Tim Berglund
    7. Acknowledgments from Matthew McCullough
  6. 1. Hello, Gradle!
    1. Build Files in Groovy
    2. Domain-Specific Build Languages
    3. Getting Started
      1. MacOS Installation with Brew
      2. Linux and MacOS Installation
      3. Windows Installation
    4. The Hello World Build File
    5. Building a Java Program
    6. The Gradle Command Line
  7. 2. Gradle Tasks
    1. Declaring a Task
    2. Task Action
    3. Task Configuration
    4. Tasks Are Objects
      1. Methods of DefaultTask
      2. Properties of DefaultTask
      3. Dynamic Properties
    5. Task Types
      1. Copy
      2. Jar
      3. JavaExec
    6. Custom Task Types
      1. Custom Tasks Types in the Build File
      2. Custom Tasks in the Source Tree
    7. Where Do Tasks Come From?
    8. Conclusion
  8. 3. Ant and Gradle
    1. The Vocabulary
    2. Hello Ant
    3. Importing Custom Ant Tasks
    4. Complex Ant Configuration
    5. Importing an Entire Ant Build File
    6. Ant Target and Gradle Task Codependence
    7. Using AntBuilder
    8. A Harmonic Duo
  9. 4. Maven and Gradle
    1. Cue Graven?
    2. The Maven POM and Gradle Build
    3. Maven Goals, Gradle Tasks
    4. The Standard Maven Coordinates, Gradle Properties
    5. More Gradle Properties
    6. Dependencies
    7. Repositories
    8. Unit Testing
    9. Multiple Source Directories
    10. Default Tasks
    11. The Maven Plug-in
    12. Installing to the Local Maven Repository (Cache)
    13. Publishing to a Maven Repository
    14. Maven2Gradle Build Script Converter
    15. Maven POM Import
    16. Conclusion
  10. 5. Testing with Gradle
    1. JUnit
    2. TestNG
    3. Spock
    4. Geb and EasyB
    5. Gradle’s Testing Focus
  11. 6. Multiproject Builds
    1. Multiproject Build Structure
    2. Project-Specific Build Files
    3. One Master Build File
    4. A Hybrid Multiproject Build
    5. Individual, Unified, or Hybrid?
    6. Multiproject Task Structure
    7. Multiple Projects Your Way
  12. About the Authors
  13. Colophon
  14. SPECIAL OFFER: Upgrade this ebook with O’Reilly
  15. Copyright
O'Reilly logo

Chapter 6. Multiproject Builds

Large projects are typically broken up into separate modules with independent build lifecycles. Each subproject has some kind of life of its own, perhaps with a development team assigned to it alone, and certainly with a test suite of its own which is worthwhile to run apart from the project as a whole. However, any large system that is broken into pieces must also be reintegrated together, implying the need for a master build that combines all subprojects into a single integration test suite and set of release artifacts or processes. A next-generation build system will be equipped to provide a flexible framework for dealing with real-world project differentiation and integration.

Multiproject Build Structure

A multiproject is generally hierarchical in nature: it typically has a master project with one or more subprojects. In some cases, subprojects may be nested. The master project goes in a top-level directory, with subprojects arranged in subdirectories underneath. The master project may add code, resources, tests, and build conventions of its own, or it may simply be build glue that holds the project tree together.

In the most intuitive case, Gradle allows you to define a build file for the top-level project and one for each subproject. In a more interesting and potentially more useful case, it also lets you define the entire build from the top-level build file. Alternatively, if neither a scattered set of individual build files nor a single, integrated ...

The best content for your career. Discover unlimited learning on demand for around $1/day.