22 Maven
22 Maven
Apache Maven
===============
1) What is Java
2) Java Projects
3) Java Project Execution Flow
4) What is Build Proces
5) What is Build Tool
6) Why we need build tools
7) Maven Introduction
8) Maven Setup (windows & linux)
9) Maven Dependencies
10) Maven Goals
11) Maven Repositories
12) Working with Maven
================
What is Java ?
================
1) Stand-alone applications
2) Web applications
=> The application which is accessible only in one computer is called as stand-
alone application.
=> The application which can be accessed by multiple users at a time is called as
web application.
============================
Java Project Execution Flow
============================
2) Compile source code (java compiler) => It generate byte code (.class files)
=============================
Java Projects Build Process
=============================
=> To avoid manual build process, build tools came into picture
=================
What is Maven ?
=================
===================
What maven can do
===================
Step-1: Create Amazon linux vm and connect with that using ssh client
$ mvn -version
Note: To use maven java is required. When we install maven using package manager
then it will install java also.
===========================
Maven Setup in Windows
===========================
===================
Maven Terminology
==================
=> Archetype
=> Group ID
=> Artifact ID
=> Version
=> Packaging Type
=> Maven Dependencies
=> Maven Goals
=> Maven Repositories
=========================================
Creating Maven Stand-alone application
=========================================
$ tree sbi-app
=> Inside the project we can see 'src' folder and pom.xml file
Note: Once project created, we can use maven goals to perform build process.
=============
Maven Goals
=============
$ mvn <goal>
=========================================
Creating Maven Web application
=========================================
$ cd <project-directory>
=> Once build got success we can see 'target' directory inside project directory.
It contains byte code and our project artifact (war file).
===================
Maven Dependencies
===================
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>6.1.7</version>
</dependency>
=> Add above dependency in project pom.xml file under <dependencies/> section and
execute maven goals.
===================
Maven Repositories
===================
1) Local Repository
2) Cental Repository
3) Remote Repository
=> Remote Repository will be maintained by our company to store shared libraries.
Note: Only First time maven will download dependencies from central / remote
repository to local repository.
=> Maven project will take dependencies from local repository (.m2).
==================
Maven - Summary
==================
1) What is Java
2) Java Projects Execution Flow
3) Stand-alone vs Web App
4) What is Build Process
5) Build Tools
6) What is Maven
7) What maven can do
8) Maven setup (windows & linux)
9) Maven Terminology
10) Maven Project Creation
11) Maven Dependencies
12) Maven Goals
13) Maven Repositories
==================
Important Points
==================