Important Announcement
PubHTML5 Scheduled Server Maintenance on (GMT) Sunday, June 26th, 2:00 am - 8:00 am.
PubHTML5 site will be inoperative during the times indicated!

Home Explore Maven / Gradle Lab Manual

Maven / Gradle Lab Manual

Published by Teamlease Edtech Ltd (Amita Chitroda), 2022-08-30 10:23:35

Description: Maven / Gradle Lab Manual

Search

Read the Text Version

JAVA Maven / Gradle FULL STACK DEVELOPMENT

Objectives of this Lab Manual This lab manual includes - Exercises for hands on practice Guidelines to complete the exercise Learning Outcome

Contents This lab manual includes the following exercises- 1. Creation of a Maven Project 2. Creation of a Gradle Project

Creation of a Maven Project

Problem What will you do? Statement Create a POM.xml file for a maven project. Implement the standard library of Scala Programming Language in your maven project.

Solution What will be the steps Steps to get the output? • Step-1: Open your IDE and create a maven project. We are creating a maven project because we can easily add the dependencies.

Solution What will be the steps Steps to get the output? • Step-2: Select maven-archetype-quickstart as the archetype.

Solution What will be the steps Steps to get the output? • Step-3 : Give your project an appropriate name, group id and artifact id. Finish the setup and your project will be created. • Step-4: Now, take a look at the project structure to locate and open the POM.xml file.

Solution What will be the steps Steps to get the output? • Step-5: Open the maven repository by visiting this website.

Solution What will be the steps Steps to get the output? • Step-6: Search for scala library and open the repository.

Solution What will be the steps Steps to get the output? • Step-7: Choose the appropriate version and copy the dependency code.

Solution What will be the steps Steps to get the output? • Step-8:Paste the dependency in the POM.xml file of your maven project.

Solution What will be the steps Steps to get the output? • Step-9: Now update the project to include the JAR files of mentioned dependencies.

Solution What will be the steps Steps to get the output? • Step-10: Now, as you can see, all the JAR files are added.

Learning Outcome After Performing this Add teExxt ehrecries:e- You’ll be able to create a project for maven, work with the POM.xml file and Implement dependencies in the maven project.

Creation of a Gradle Project

Problem What will you do? Statement Create a Gradle project. Program a task to display hello world in the build.gradle file

Solution What will be the steps Steps to get the output? • Step-1: Open command prompt and make sure you have recent version of gradle. • Command – gradle -version • Output –

Solution What will be the steps Steps to get the output? • Step-2: Initialize the Gradle project. • Command – gradle init • Output –

Solution What will be the steps Steps to get the output? • Step-3: Select the type of the Gradle project. • Output –

Solution What will be the steps Steps to get the output? • Step-4: Select the build script DSL of the Gradle project. • Output –

Solution What will be the steps Steps to get the output? • Step-5: Enter the name of the Gradle project. • Output –

Solution What will be the steps Steps to get the output? • Step-6: Now, open the directory where the Gradle project is created and open the build.gradle file.

Solution What will be the steps Steps to get the output? • Step-7: Write the code to display “Hello World”. • task test { • doLast { • println 'Hello World' •} •}

Solution What will be the steps Steps to get the output? • Step-8: Execute the task. • Command – gradle -q test • Output –

Learning Outcome After Performing this Add teExxt ehrecries:e- You will be able to create a project for Gradle, work with build.gradle file and display a message.

Happy Learning!


Like this book? You can publish your book online for free in a few minutes!
Create your own flipbook