Gradle Dependency Management

Book description

Learn how to use Gradle's powerful dependency management through extensive code samples, and discover how to define, customize, and deploy dependencies

In Detail

Gradle is the next generation in build automation. It allows you to define dependencies for your project in a clear way and also customize how they are resolved to suit your needs. It offers fine-grained control over how to publish your artifacts to Maven and Ivy repositories.

Gradle Dependency Management defines dependencies for your Java-based project and customizes how they are resolved. You will learn how to configure the publication of artifacts to different repositories. Packed with plenty of code samples, you will understand how to define the repositories that contain dependencies. Following this, you will learn how to customize the dependency resolution process in Gradle.

What You Will Learn

  • Define dependencies in your Java projects
  • Publish your artifacts to Maven and Ivy repositories
  • Configure transitive dependencies
  • Install your artifacts in Bintray
  • Customize the resolution of dependency rules
  • Use your own code as dependencies in a multimodule project
  • Configure repositories to resolve dependencies

Table of contents

  1. Gradle Dependency Management
    1. Table of Contents
    2. Gradle Dependency Management
    3. Credits
    4. About the Author
    5. About the Reviewers
      1. Support files, eBooks, discount offers, and more
        1. Why subscribe?
        2. Free access for Packt account holders
    7. Preface
      1. What this book covers
      2. What you need for this book
      3. Who this book is for
      4. Conventions
      5. Reader feedback
      6. Customer support
        1. Downloading the example code
        2. Downloading the color images of this book
        3. Errata
        4. Piracy
        5. Questions
    8. 1. Defining Dependencies
      1. Declaring dependency configurations
      2. Declaring dependencies
        1. External module dependencies
        2. Defining client module dependencies
        3. Using project dependencies
        4. Defining file dependencies
        5. Using internal Gradle and Groovy dependencies
      3. Using dynamic versions
      4. Getting information about dependencies
        1. Accessing dependencies
        2. Buildscript dependencies
      5. Optional Ant task dependencies
      6. Managing dependencies
      7. Summary
    9. 2. Working with Repositories
      1. Declaring repositories
        1. Using the Maven JCenter repository
        2. Using the Maven Central repository
        3. Using the Maven local repository
        4. Using Maven repositories
        5. Using the flat directory repository
        6. Using Ivy repositories
      2. Using different protocols
      3. Summary
    10. 3. Resolving Dependencies
      1. Understanding dependency resolution
        1. Configuring transitive dependencies
        2. Disabling transitive dependencies
        3. Excluding transitive dependencies
        4. Using artifact-only dependencies
      2. Resolving version conflicts
        1. Using the newest version
        2. Failing on version conflict
        3. Forcing a version
      3. Customizing dependency resolution rules
        1. Using client modules
      4. Using dynamic versions and changing modules
      5. Understanding the dependency cache
        1. Command-line options for caching
        2. Changing cache expiration
      6. Summary
    11. 4. Publishing Artifacts
      1. Defining artifact configurations
      2. Defining artifacts
        1. Using the archive task
        2. Using artifact files
      3. Creating artifacts
      4. Publishing artifacts to the local directory
        1. Excluding the descriptor file
      5. Signing artifacts
        1. Using configurations to sign
        2. Using archive tasks to sign
      6. Summary
    12. 5. Publishing to a Maven Repository
      1. Defining publication
      2. Defining publication artifacts
      3. Using archive task artifacts
      4. Using file artifacts
      5. Using software components
      6. Generating POM files
        1. Customizing the POM file
      7. Defining repositories
        1. Publishing to the local Maven repository
        2. Publishing to the Maven repository
        3. Publishing to Artifactory
        4. Publishing to Nexus
      8. Summary
    13. 6. Publishing to Bintray
      1. What is Bintray?
        1. Defining a new repository
      2. Defining the Bintray plugin
      3. Deploying publications to Bintray
      4. Configuring the Bintray plugin
      5. Summary
    14. 7. Publishing to an Ivy Repository
      1. Defining publications
      2. Defining publication artifacts
      3. Using archive task artifacts
        1. Using file artifacts
        2. Using software components
      4. Generating Ivy descriptor files
        1. Customizing the descriptor file
      5. Defining repositories
        1. Publishing to a local directory
        2. Publishing to Artifactory
        3. Publishing to Nexus
      6. Summary
    15. Index

Product information

  • Title: Gradle Dependency Management
  • Author(s): Hubert Klein Ikkink
  • Release date: June 2015
  • Publisher(s): Packt Publishing
  • ISBN: 9781784392789