Mave N
Mave N
=> 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),
=> 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
=> 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
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 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
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)
=> 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)
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
new --->
3) make sure that _—_‘ the bin directory jdk s/w installation is added to PATH
env.. variable
%SystemRoot%
%SystemRoot%\System32\Wbem
%SYSTEMROOT%\System3 2\WindowsPowerShell\v1.0\,
%SYSTEMROOT%\System32\OpenSSH\
~ ts
C:\>
C:\>
C:\>java -version
This PC ---->properties ----> advanced system settings ---> env.. variables -->
system variables --->
5) make sure that the "bin" directory of the maven software installation is added
to PATH variable
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
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