Maven Repository :
Open source, Java based project management and build tool.
Dependencies is going to look one of these repository.
1. Maven Local Repository
C:\Users\chandrasekhar\.m2\repository
we can change this in settings.xml file in maven conf directory.
<!-- localRepository
| The path to the local repository maven will use to store artifacts.
|
| Default: ${user.home}/.m2/repository
<localRepository>/path/to/local/repo</localRepository>
-->
2. Maven Central Repository
By default, Maven will get project dependencies from Maven Local Repository,
if it is not found, Maven will get it from the Maven Central Repository.
Maven Central Repository URL – https://repo.maven.apache.org/maven2
Maven Central Repository Search – https://search.maven.org/
3. Maven Remote Repository.
Not every library is stored in the Maven Central Repository, some libraries are only available
in Java.net or JBoss repository (remote repository).
You need to do some configuration in pom.xml file
1. Java.net Repository
2. JBoss repository
3. Spring repository
Maven Life Cycle:
The Maven build follows a specific life cycle to deploy and distribute the target project.
There are three built-in life cycles:
default: the main life cycle as it's responsible for project deployment
clean : to clean the project and remove all files generated by the previous build
site : to create the project's site documentation
Default: Phase
validate | Validate the project is correct and all necessary information is available. |
compile | Compiles the source code of the project. |
test | Test the compiled source code using a suitable unit testing framework |
package | Take the compiled code and package it in its distributed format, such as a JAR. |
verify | Run any checks on results of integration tests to ensure quality criteria are met. |
install | Install the package into the local repository, for use as a dependency in other projects locally. |
deploy | Done in the build environment, copies. |
Execute Projects:
1. Standalone-jar
mvn clean package or
mvn clean package -DskipTests
mvn clean package -Dmaven.test.skip=true
cd java-project
mvn package
java -jar target/java-project-1.0-SNAPSHOT.jar 123456
2. Web -war
make sure that packaging as a war in pom.xml file.
3. Enterprise
Download on example and execute
Keep watching this space for more updates,