Installing and setting up gradle

Page 1

For Evaluation Only [Type the date]

Lab:01 Installing Gradle to your System Step: 1 Download Gradle Binary distribution from. http://gradle.org/post-download-gradle/

Step: 2 Extract it on C: / Drive.

Step:3 Set the path variable with Gradle as specified below.

Copyright@xcelframeworks


For Evaluation Only [Type the date]

Set Path as specified below

Set GRADLE_HOME and JAVA_HOME.

2

For Evaluation Only


For Evaluation Only [Type the date]

Copyright@xcelframeworks


For Evaluation Only [Type the date]

Add below Entries in Path as specified below.

4

For Evaluation Only


For Evaluation Only [Type the date]

Apply the settings and launch command line .Type Gradle to verify

Lab:02 Installing Gradle plugin in Eclipse Launch Eclipse as specified below

Select Marketplace

Copyright@xcelframeworks


For Evaluation Only [Type the date]

Search Buildship as show below.

Click on Install and follow below steps to complete the Installation

6

For Evaluation Only


For Evaluation Only [Type the date]

Click Confirm.

Click on finish and monitor the Progress Bar to complete.

Copyright@xcelframeworks


For Evaluation Only [Type the date]

Click on restart eclipse button

Once Eclipse starts Create a Gradle Project . File > New > Other.

Click Next.

8

For Evaluation Only


For Evaluation Only [Type the date] Note: When clicking Next > you get the following Gradle wizard page, where you can specify a name for your Gradle Java project, an alternative location or the default workspace one. And you can directly add your new project to certain workingsets.

Create Project specifying it a name

Copyright@xcelframeworks


For Evaluation Only [Type the date]

Set the following options though they are optional.

1 0

For Evaluation Only


For Evaluation Only [Type the date]

Check the preview and click on finish

Once Finish you get a Project with following Directory Structure.

Also view Gradle Task View as specified below

Copyright@xcelframeworks


For Evaluation Only [Type the date] Verify gradle.build file.

Lab:03 Converting from Gradle to Maven Project Steps select the project go to configure and select below option

Click Convert to Maven and verify the properties in dialog

1 2

For Evaluation Only


For Evaluation Only [Type the date]

Click on Finish to generate Maven artifacts and pom.xml.Once pom.xml is created verify the file.

Copyright@xcelframeworks


For Evaluation Only [Type the date] Lab:04 Converting Maven to Gradle Create a Maven Project using Eclipse as specified below.

Select Archtype as specified below

1 4

For Evaluation Only


For Evaluation Only [Type the date] Specify GroupId and Artifact Id.

Click on finish to generate the project. Verify the Directory structure and pom.xml

pom.xml entries:

Copyright@xcelframeworks


For Evaluation Only [Type the date]

Go to command prompt and change the directory to current maven project as specified in below case.

Type in the below gradle command.

It Builds and generate the required artifact.

1 6

For Evaluation Only


For Evaluation Only [Type the date] Check out your eclipse project as specified below click refresh

Check the directories and generated gradle artifact.

Open build.gradle and verify the constructs.

Copyright@xcelframeworks


For Evaluation Only [Type the date]

Lab:05 Working with Gradle Task This lab illustrates working with default Gradle tasks which are delivered by default. Launch command prompt and type the command given below:

Wait for output.It displays all the tasks as depicted in the output grouped into various categories

1 8

For Evaluation Only


For Evaluation Only [Type the date]

To get help on specific task use the below at command prompt:

Creating a java project using Gradle task

Copyright@xcelframeworks


For Evaluation Only [Type the date] Step: 1 Create a folder you want the project to be generated move to that folder and use init task .Follow the steps specified below.

Import the project in Eclipse as specified below

Click on next on below screen

2 0

For Evaluation Only


For Evaluation Only [Type the date]

Select the project to import

Specify gradle and java parameters as specified below.

Copyright@xcelframeworks


For Evaluation Only [Type the date]

Review Imports.

Check build.gradle file .

2 2

For Evaluation Only


For Evaluation Only [Type the date]

Building Custom Task in Gradle Gradle provides capability of building custom tasks .To build your custom task add the following entry in build.gradle file.

Go to command prompt ensure you are in project folder and run following commands.

Copyright@xcelframeworks


For Evaluation Only [Type the date]

Verify output of gradle task commands you will find webage as a task in others section as specified below.

Execute Gradle task as specified.

2 4

For Evaluation Only


Turn static files into dynamic content formats.

Create a flipbook
Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.