gradle : an introduction

8
Gradle I What is Gradle? Benefits of Gardle. 2 Get Started with Gadle Using Gradle in ID 3 Summary 08/26/2022

Upload: nibodha-technologies

Post on 04-Aug-2015

103 views

Category:

Technology


0 download

TRANSCRIPT

Page 1: Gradle : An introduction

04/15/2023

Gradle

I

•What is Gradle?

•Benefits of Gardle.

2

•Get Started with Gadle

•Using Gradle in ID

3•Su

mmary

Page 2: Gradle : An introduction

04/15/2023

Introduction to Gradle & benifits

• Gradle is build automation evolved. • Gradle can automate the building, testing,

publishing, deployment .• Gradle combines the power and flexibility of

Ant with the dependency management and conventions of Maven into a more effective way to build.

• Powered by a Groovy DSL and packed with innovation

Page 3: Gradle : An introduction

04/15/2023

Get Started with Gadle• Download the latest Gradle release from Gradle website.• For running Gradle, add GRADLE_HOME/bin toyour PATH environment variable

& check your installation by typing gradle -v in command prompt.

• We run Gradle built using gradle command.It will look for the bulid.gradle as built script.

• Ex .1: Simple Hello world• build.gradle

task hello { // Task name hellodoLast { println 'Hello world!' } // Groovy script

}• Execution of a build script > gradle -q hello

> Hello world!

Page 4: Gradle : An introduction

04/15/2023

• Ex.2 :Task dependencies• task compile << {• println 'compiling source'• }

• task compileTest(dependsOn: compile) << {• println 'compiling unit tests'• }

• task test(dependsOn: [compile, compileTest]) << {• println 'running unit tests'• }

• task dist(dependsOn: [compile, test]) << {• println 'building the distribution'• }

Page 5: Gradle : An introduction

04/15/2023

• Few Commands : • Exclude a task : gradle dist -x test• Task by abbreviation• Abbreviated camel case task name :

Ex:compileTest as gradle compTest or even gradle cT• Selecting the build to be executed :

Ex:gradle -q -b subdir/myproject.gradle hello• Listing projects : gradle -q projects• Continue entire task execution when built failure --continue• Listing tasks : gradle -q tasks• List Dependencies : gradle dependencies• Report generation: --profile

Page 6: Gradle : An introduction

04/15/2023

• Summary• apply plugin: 'java'• apply plugin: 'eclipse'• sourceCompatibility = 1.5• version = '1.0'• jar {• manifest {• attributes 'Implementation-Title': 'Gradle Quickstart',• 'Implementation-Version': version• }• }• repositories {• mavenCentral()• }• dependencies {• compile group: 'commons-collections', name: 'commons-collections', version: '3.2'• testCompile group: 'junit', name: 'junit', version: '4.+'• }• uploadArchives {• repositories {• flatDir {• dirs 'repos'• }• }• }

Page 7: Gradle : An introduction

04/15/2023

• Defining a multi-project build• To define a multi-project build, we need to create a settings file in the root

directory of the source tree.• It specifies which projects to include in the build.• It must be called settings.gradle

• Example 7.11. Multi-project build - settings.gradle file settings.gradle• include "shared", "api", "services:webservice", "services:shared“• Refer the example for better clarity.

----------------------------------------------------------------END----------------------------------------------------------------------

Page 8: Gradle : An introduction

04/15/2023

Conclusion

• No slide is enough to content a technology.• Learning never ends.• Happy learning…!