Maven
STS
Mentorships
W h o AM I?
Graduated 2022 from faculty of computer
Engineering Worked 1 year as an IT Help
Desk, and currently working as an IT System
Administrator.
And I’m so interested in Software Testing filed
Ahmed Elkholy
System Administrator
Maven is a build and management tool that simplify
Building, Testing, Reporting and Packaging of project.
- To download a library before maven you have to
download all it’s JAR files inside your project that hassle
also with update.
Dependency : a third-party for downloading libraries
needed for the project
Plugins: for project configurations
-Local Repo & Remote Repo (maven repository )
Why Maven is Popular ?
1- Standard Directory Structure
2- Declarative Dependency Management
3- Tool Support (IDEs)
4- Open Source (Java Build)
Install Java
1. Download Java JDK from for windows 64 installer This Link and Install it
2. Add Home Path to Environment Variable
3. Add bin Path to Environment Variable in path Section
4. Check Correction of installation using cmd >java –version , javac -
version
Install Maven
1. Download Java Maven from for windows 64 installer This Link and Install
it Add Home Path to Environment Variable
2.
3. Add bin Path to Environment Variable in path Section
4. Check Correction of installation using cmd >>mvn -v
Create Maven Project
Maven Directory Structure
Target: Facilitate Build Process by
Contain all resources during build
process.
SRC: contains code and resources for
both Development and Test process.
Pom.xml: Central Piece of
information
that contains all information about The
Project
(Building – Testing – Reporting – Packaging ).
Lifecycle, Phase, Plugin and Goal
Lifecycle: group of phases.
Phase: when execute it all previous should be executed.
Plugin: group of goals.
Goal: piece of functionality like clean and compile, could be executed
separately.
Clean: cleans temp files from target directory . {mvn clean}
Site: handle generation of documentations . {mvn site}
Build: consists of many like phases. {mvn compile, test, package }
Create archetype
What is archetype?
It is a maven template that allows user to create new project easily.
mvn archetype:generate
This command generates skeleton Maven projects of different types, such as JAR, web application, Maven site, etc
Dependencies: external libraries for project includes
dependencies for that dependency (Transitive Dependency).
You can get any dependency from maven repository website
Maven Commands
Validate: to ensure that everything is correct and all the necessary information is
available
Clean: cleans the Maven project by deleting the target directory
Commands are used using Intellij Terminal
Maven Commands
mvn compile: This command compiles the source Java classes of the project
Maven Commands
mvn test: This command runs the test cases of the project:
Mvn package: This command builds the Maven project and packages it into a JAR,
WAR, etc
Maven Commands
mvn install: This command builds the Maven project and installs the project files (JAR, WAR,
pom.xml, etc.) to the local repository
Mvn deploy: This command deploys the artifact to the remote repository:
Maven Commands
mvn -v: This command-line option displays the Maven version information:
Mvn site: This command generates a site (Documentation) for the project in target
directory
S t u d y i n g Re s o u rc e s
Article : Link Is Here
English YouTube Playlist : Link Is Here
Arabic YouTube Playlist : Link Is Here
Thank You
S e c o n d Pa r t M a v e n