Maven
Repository
-
In Maven we have three repositories
- Local Repository (~/.m2/repository)
- Remote Repository: Present with in organizational boundary where we can download dependencies and store artifacts. Jfrog and Nexus can be used as Remote Repositories
- Central Repo: Open public repository having all the public dependencies
-
Goals:
- install: copy the artifact into local repository
- deploy: copy the artifact into remote repository
- Maven settings file: If we need to configure maven with remote repository location or other configuration details
~/.m2/settings.xmlRefer Here for official docs
Lets build a maven project
- Install maven
- lets use spring petclinic Refer Here
- Lets execute maven phases
mvn validate
mvn compile
mvn test
mvn package
mvn install
-
Compilation, test, package and install a target folder will be created
- compile: will create .class files
- test: will run unit tests and creates test reports in xml format
- package: will create a jar or war file
- install: will copy jar an pom to local repo
- Exercise: Try building openmrs core Refer Here
