Mastering Gradle
eBook - ePub

Mastering Gradle

Mainak Mitra

Share book
  1. 284 pages
  2. English
  3. ePUB (mobile friendly)
  4. Available on iOS & Android
eBook - ePub

Mastering Gradle

Mainak Mitra

Book details
Book preview
Table of contents
Citations

About This Book

If you are a developer with some experience in build tool and want to become an expert in build tool, then this book is for you. Basic knowledge of Gradle or any other build tool is essential.

Frequently asked questions

How do I cancel my subscription?
Simply head over to the account section in settings and click on “Cancel Subscription” - it’s as simple as that. After you cancel, your membership will stay active for the remainder of the time you’ve paid for. Learn more here.
Can/how do I download books?
At the moment all of our mobile-responsive ePub books are available to download via the app. Most of our PDFs are also available to download and we're working on making the final remaining ones downloadable now. Learn more here.
What is the difference between the pricing plans?
Both plans give you full access to the library and all of Perlego’s features. The only differences are the price and subscription period: With the annual plan you’ll save around 30% compared to 12 months on the monthly plan.
What is Perlego?
We are an online textbook subscription service, where you can get access to an entire online library for less than the price of a single book per month. With over 1 million books across 1000+ topics, we’ve got you covered! Learn more here.
Do you support text-to-speech?
Look out for the read-aloud symbol on your next book to see if you can listen to it. The read-aloud tool reads text aloud for you, highlighting the text as it is being read. You can pause it, speed it up and slow it down. Learn more here.
Is Mastering Gradle an online PDF/ePUB?
Yes, you can access Mastering Gradle by Mainak Mitra in PDF and/or ePUB format, as well as other popular books in Informatica & Programmazione open source. We have over one million books available in our catalogue for you to explore.

Information

Year
2015
ISBN
9781783981366

Mastering Gradle


Table of Contents

Mastering Gradle
Credits
About the Author
About the Reviewers
www.PacktPub.com
Support files, eBooks, discount offers, and more
Why subscribe?
Free access for Packt account holders
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Downloading the example code
Errata
Piracy
Questions
1. Getting Started with Gradle
Understanding Build Automation System
Need for BAS
Gradle overview
Installation and quick start
Pre-requisites
Gradle for Windows
Gradle for Mac/Linux
The Gradle JVM option
Our first script
Gradle command Line arguments
The Gradle GUI
Start up script
Build life cycle
Initialization
Configuration
Execution
Cache management
Cache location
Change Cache location
Cache features
Reduce the traffic
Dependency location
Version integration
Switching off remote checking
Version conflicts
Gradle with IDE
Installing the Gradle plugin in Eclipse
Working with the Gradle project in IDE
Summary
2. Groovy Essentials for Gradle
Overview
Integration with Java
Minimum code
Simpler I/O operations
Integration with Ant
Builder classes
Closure
Groovy script for Hello World
Data types
String
Dynamic typing in Groovy
Classes, beans, and methods
Control structures
The if-else condition
The switch statement
Loops
Collections
Set
List
Map
Range
Closure
Builder
Summary
3. Managing Task
Build script basics
Task configuration
Task execution
Task dependency
Task ordering
Task operations
Conditional execution
Build optimization
Task rules
Gradle's in-built tasks
The Copy Task
The Rename Task
The Zip task
Custom tasks
Using buildSrc
The standalone task
Summary
4. Plugin Management
The script plugin
The binary plugin
Gradle's in-built plugins
Build and Test plugins
Code analysis plugins
IDE plugins
The Java plugin
Conventions
Configuration
The custom plugin
The build file
The buildSrc directory
The Standalone project
Summary
5. Dependency Management
Overview
Dependency configurations
Dependency types
Repositories
Repositories configuration
Dependency resolution
Transitive dependency
Exclude transitiveness
Selective exclude
Version conflicts
Dynamic dependency
Customizing the dependency
Download file other than JAR
Dependency on files with classifiers
Replacing transitive dependencies
Custom configuration for dependency
Dependency reports
Dependency-specific details
Publishing artifacts
Default artifacts
Custom artifacts
Generate additional XML file along with your JAR file
Generate an additional ZIP file along with your JAR file
Custom configuration
The maven-publish plugins
Publishing to the local-hosted repository
Custom POM
Summary
6. Working with Gradle
The War plugin
The Scala plugin
Logging
File management
Reading files
Writing files
Creating files/directories
File operations
Filter files
Delete files and directories
FileTree
Property management
ext closure
gradle.properties
The command line
The Custom properties file
Multi-project build
The Multi-project structure
The Multi-project execution
Task execution
The Flat hierarchy
Interproject dependency
Configuration-level dependency
Task-level dependency
Library dependency
Partial builds
buildDependents
buildNeeded
Testing with Gradle
JUnit
Test configuration
maxParallelForks
The forkEvery option
ignoreFailures
filter
TestNG
Execution based on group
Execution based on the TestNG suite file
Summary
7. Continuous Integration
Jenkins walk-through
Jenkins installation
Jenkins configuration
Create job
Execute job
Checkstyle and PMD plugins
The Sonar Runner plugin
TeamCity walk-through
Summary
8. Migration
Migration from Ant
Importing Ant file
Accessing properties
Update Ant tasks
Using AntBuilder API
Rewriting to Gradle
Configuration
Migration from Maven
Build filename and project properties
Properties
Dependency management
Exclude transitive
Plugin declaration
Repository configuration
Multi-module declaration
Default values
Gradle init Plugin
Summary
9. Deployment
Role of Gradle in deployment
Docker overview
Installing Docker
Docker commands
Help command
Download image
The list of images
Creating a container
The container list
Start/stop container
Connecting to a container
Deleting a container
Removing an image
Copying files to the container
Container details
Updating DNS settings
Creating an image from a container
Running an application in Docker
Build, Deployment, and Test pipeline
Summary
10. Building Android Applications with Gradle
Creating Android project using Android Studio
Building the Android project with Gradle
buildTypes
ProGuard settings
Build flavors
Running the application on a device/emulator
Signing the release version
Summary
Index

Mastering Gradle

Copyright © 2015 Packt Publishing
All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or ...

Table of contents