Maven
Maven
--if any mistake identified then developer performs above task again and again.
build process: keeping our project ready for execution/release is called build
process.
--manually doing this build process will increase the burden on developer
--to automate this build process of java applicaiton , apache foundation released
a tool called ANT (Another Neet Tool).
1. ANT does not have the capabilities of donwloading the required jar files from
internate automatically.
3.In ANT we need to write a build.xml file which is very lenghty xml file.
--Gradle
--we can develop java application using Maven by 2 ways:
1.using console based (here we need to download the maven s/w and install it in our
local computer ,and then we need to set path and some environment variable to
develop java application)
2.using IDE: here we don't need to install any kind of extra s/w.
STS has inbuilt support of Maven and Gradle
Maven terminology:
===============
1. artifact :-
--An artifact is an outcome in maven, it can be a file, .class file or a jar file,
war file,ear file,etc.
2. archetype:-
3. Groupid:
4.artiactid : it is the id for the final outcome (artifactid name will be the root
folder of our application)
5.pom.xml : (project object model) : all the information will be their in this
file.
1. Name
2.version
docker
jenkins (CI/CD)
Maven Repository:
================
1.central repo :- it is the maven's own repo in which it maintains all kinds of
project related plugins, archetypes, jars etc.
https://repo1.maven.org/maven2
2.remote repo : this repo is maintained within the organization for sharing
plugins, archetypes and jar files for multiple projects withing orgnizations.
3.local repo: this repo will be created inside the developer computer. (.m2) is
the name for this repo.
mysql-connector.jar
pom.xml:
.m2 ---
1. validate: - in this phase it will verify the project diectory structure is valid
or not. and it has pom.xml file is there or not.
2.compile: maven compiles all the source code of the project by downloading and
adding requied jar files in the classpath.
3.test-compile: if we have written any unit test cases those code will be compiled.
4.test : maven will run all the test cases and it will show how many test cases are
success and how many fails.
5.package : maven will bundle our java code into a jar file inside 'target' folder.
7.deploy : maven stores the application jar file to the central repo.
8.clean : here maven will delete and remove all the files that are generated in
previous build.
Note: if we execute any phase to build the maven project then maven will execute
all the phases till that given phase.
src/test/resources : any xml file, properties files, text files to unit testing
after creating a maven project we need to change the java version of the maven
project from jdk 5 to jdk 8
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
after pasting the above tag inside the pom.xml file we need to update our maven
project: