0% found this document useful (0 votes)
23 views4 pages

Mave N

The document discusses build automation tools, specifically focusing on Maven and its advantages over other tools like Ant. It outlines the build process for Java projects, detailing Maven's capabilities such as dependency management, project structure creation, and integration with CI/CD tools like Jenkins. Additionally, it provides installation instructions for Maven and emphasizes the importance of the pom.xml configuration file.

Uploaded by

rahulbadhe630
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
23 views4 pages

Mave N

The document discusses build automation tools, specifically focusing on Maven and its advantages over other tools like Ant. It outlines the build process for Java projects, detailing Maven's capabilities such as dependency management, project structure creation, and integration with CI/CD tools like Jenkins. Additionally, it provides installation instructions for Maven and emphasizes the importance of the pom.xml configuration file.

Uploaded by

rahulbadhe630
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 4

=> This is called Build Automation tool

=> The process of keeping our App or Project ready for execution is called Build
Process

=> As part of build process there will be lots of complicated and repeatative
operations to perform
until we get statisfactory results in App / project execution ..

The operations are like create directory structure , add jar files file to
classpath ,
adding jar files to lib folder, compilation of source code, copying supporting
files like images, audio files and etc.. , server cfg, packing of code (war/jar
file),

deployment and etc..

=> Instead of doing the above said operations manually for multiple times by
remembering their
order itis better to automate the process using the support of build tool.

Build Tools

Ant (Another Neat Tool ) ----> from Apache

Maven --------------- > from apache (a)


MS Build ----------------> from Microsoft
Gradle _ ----------------- >

From Gradle Inc (b)


and etc..

=> Using maven build tool , we can automate only Java Project's build process.
=> Using gradle build tool , we can automate both Java and non-java Project's build
process.

=> In realtime 70% JAva Projects are using maven as the build tool
30% java projects are using gradle as the build tool

=> Maven tool is successor tool for Anttool from apache software vendor

=> Ant Tool is procedural tool i.e we need to instruct each and every activity of
the build process
tothe Ant Tools (very bad becoz no self intelligence)

=> Maven Tool is Declarative tool having life cycle i.e weneed not to instruct each
and every
aspects, it completes majority of the activities based on final outcome instruction
we are

giving (maven is self intelligent)

eg:: if ask maven to pack the code to war/jar file .. but it will be complete all
the
before activities like compilation, add jar files to classpath and etc..

Build
=>Using Maven we can perform the following operations in Java Project's process
(a) Can create initial directories required for different types of Projects
(b) can download the jar files (dependencies) from internet
(c) can add the jar files to the PRoject's Build Path /CLASSPATH

Spring Boot Project /App

. ‘» Spring core jar files

=> Spring core


= i Spring boot core jar files .
=>Spring boot corq —————= = Pring } In maven Terminology

=>spring data jpa /fpibernate ------- > Spirng data jpa, hibernate jar files these
are called Project
=>Redis cache _ --}------------------ >Redis jar files dependencies
=> apache kafk feenaennennennm=> Kafka jar files

=> Spring web Mvc_ -------.....-...-.-- > spring web mvc jar files
(d) takes care of transitive dependency

(if we give information about main jar files to maven tool,


it can will download and add to classpath main jar files and
dependent jar files and their dependent jar files)
(e) Compilation of the java source code

(f) Packing of the code to jar file/war file


(g) Execution of Junit Testcase

(h) Generating Junit Test reports as html file content

(i) Gives built-in de compiler to see the source code of


pre-defined apis and third party api classes

(j) Gives the Project report as the html file

and etc...

Maven's Objectives

=>Making the build process easy (by taking care multiple things as part of life
cycle activities)
=>Providing a uniform build system (same build process for all types of projects)

=>Providing quality project information (It is able generate different reports


about the project)
=>Encouraging better development practices ( Good practices of coding)

=> Build Process :: Keeping the code ready for execution ( for both standalone apps
, web applications)
=> Deployment :: keeping the packed code in the server ( Only web applications/web
services)

In real projects , the maven will be used in two ways


(a) using CLI--Command Line Interface (giving commands from terminal or command
prompt) (complex practice )
(b) By Integrating with IDEs like Eclipse ,STS, IntelliJ and etc.. (Best)

note:: Jenkins is used for Cl /CD automation process ..In that maven
will be integrated with Jenkins to take care packing activities
of CI/CD process.

=> Maven is Java based Build tool , so we must install Jdk in our system to work
with Maven Tool

type :: Free and Open Source Build Tool for Java Projects
vendor :: apache
version :: 3.x

To download software:: https://maven.apache.org/download.cgi (download as zip file)

Binary zip archive apache-maven-3.9.6-bin.zip

For installation :: Extract Zip file to a folder

Keeping maven setup ready in oursystem (for CLI based practice)

note:: All latest IDEs are giving built-in maven tool

1) make sure that jdk 1.7+ is installed in the sytem

2) create JAVA_HOME env.. variable pointing to Jdk installation folder


This PC ---->properties ----> advanced system settings ---> env.. variables -->
system variables --->

new --->

Variable name: JAVA_HOME

Variable value: C:\Program Files\Java\jdk-1 7

Browse Directory... Browse File... ----> ok ---> ok --->ok

3) make sure that _—_‘ the bin directory jdk s/w installation is added to PATH
env.. variable

» Edit environment variable

C:\Program Files\Java\jdk-1 /\bin


C:\oraclexe\app\oracle\product\11.2.0\server\bin
C:\Program Files\Common Files\Oracle\Java\javapath
%SystemRoot%\system32

%SystemRoot%

%SystemRoot%\System32\Wbem
%SYSTEMROOT%\System3 2\WindowsPowerShell\v1.0\,
%SYSTEMROOT%\System32\OpenSSH\

~ ts

C:\>
C:\>
C:\>java -version

java version "17.0.9" 2023-10-17 LTS


Java(TM) SE Runtime Environment (build 17.0.9+11-LTS-201)
Java HotSpot(TM) 64-Bit Server VM (build 17.0.9+11-LTS-201, mixed mode, sharing)
4) add Maven software installation folder Location to M2_HOME or MAVEN_HOME env..
variable

This PC ---->properties ----> advanced system settings ---> env.. variables -->
system variables --->

new ---> New System Variable

Variable name: M2_HOME

Variable value: D:\apache-maven-3.9.6-binSoft\apache-maven-3.9.6

Browse Directory... Browse File... OK

5) make sure that the "bin" directory of the maven software installation is added
to PATH variable

Edit environment variable x

New
‘\Oraclexe \app Oracle \produc “2 U\Server\ DIN Edit
CAProgram Files\Common Files\Oracle\Java\javapath
%SystemRoot%\system32
%SystemRoot% Browse.
%SystemRoot%\System32\Wbem
%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\ Delete
%SYSTEMROOT%\System32\OpenSSH\
Move Up

6) Check wheather maven setup is ready or not

C:\Users\Nataraz>mvn —version
Apache Maven 3.9.6 (bc0240F3c74Udd6b6ec2920b3cd08dcc295161lae)
Maven home: D:\apache-maven-3.9.6—-binSoft\apache-maven-3.9.6
) Java version: 17.0.9, vendor: Oracle Corporation, runtime: C:\Program Files\Java\
jdk-17
Default Locale: en_US, platform encoding: Cp1252
OS name: "windows 11", version: "10.0", arch: "amd64", family: "windows"

C:\Users\Nataraz>|

=>To provide inputs and instructions to maven tool, we take the support of pom.xml
(Project Object Model)
=>This file is also called as the maven configuration file

=> web.xml file is web application's configuration file where as the pom.xml file
maven project's configuration file

You might also like