Maven - Overview
What is Maven?
Maven is a project management and comprehension tool. Maven provides developers a complete build lifecycle framework. Development team can automate the project's build infrastructure in almost no time as Maven uses a standard directory layout and a default build lifecycle.In case of multiple development teams environment, Maven can set-up the way to work as per standards in a very short time. As most of the project setups are simple and reusable, Maven makes life of developer easy while creating reports, checks, build and testing automation setups.
Maven provides developers ways to manage following:
- Builds
- Documentation
- Reporting
- Dependencies
- SCMs
- Releases
- Distribution
- mailing list
Maven History
Maven was originally designed to simplify building processes in Jakarta Turbine project. There were several projects and each project contained slightly different ANT build files. JARs were checked into CVS.Apache group then developed Maven which can build multiple projects together, publish projects information, deploy projects, share JARs across several projects and help in collaboration of teams.
Maven Objective
Maven primary goal is to provide developer- A comprehensive model for projects which is reusable, maintainable, and easier to comprehend.
- plugins or tools that interact with this declarative model.
Convention over Configuration
Maven uses Convention over Configuration which means developers are not required to create build process themselves.Developers do not have to mention each and every configuration detail. Maven provides sensible default behavior for projects. When a Maven project is created, Maven creates default project structure. Developer is only required to place files accordingly and he/she need not to define any configuration in pom.xml.
As an example, following table shows the default values for project source code files, resource files and other configurations. Assuming, ${basedir} denotes the project location:
Item | Default |
---|---|
source code | ${basedir}/src/main/java |
resources | ${basedir}/src/main/resources |
Tests | ${basedir}/src/test |
distributable JAR | ${basedir}/target |
Complied byte code | ${basedir}/target/classes |
Developers can build any given Maven project without need to understand how the individual plugins work. Refer to Maven Plug-ins section for more detail.
Maven Environment Setup
Maven is Java based tool, so the very first requirement is to have JDK installed on your machine.System Requirement
JDK | 1.5 or above. |
---|---|
Memory | no minimum requirement. |
Disk Space | no minimum requirement. |
Operating System | no minimum requirement. |
Step 1 - verify Java installation on your machine
Now open console and execute the following java command.OS | Task | Command |
---|---|---|
Windows | Open Command Console | c:\> java -version |
Linux | Open Command Terminal | $ java -version |
Mac | Open Terminal | machine:~ joseph$ java -version |
OS | Output |
---|---|
Windows | java version "1.7.0_75"
Java(TM) SE Runtime Environment (build 1.7.0_75-b13) Java HotSpot(TM) Client VM (build 24.75-b04, mixed mode, sharing) |
Linux | java version "1.7.0_75"
Java(TM) SE Runtime Environment (build 1.7.0_75-b13) Java HotSpot(TM) Client VM (build 24.75-b04, mixed mode, sharing) |
Mac | java version "1.7.0_75"
Java(TM) SE Runtime Environment (build 1.7.0_75-b13) Java HotSpot(TM)64-Bit Server VM (build 24.75-b04, mixed mode, sharing) |
Step 2: Set JAVA environment
Set the JAVA_HOME environment variable to point to the base directory location where Java is installed on your machine. For exampleOS | Output |
---|---|
Windows | Set the environment variable JAVA_HOME to C:\Program Files\Java\jdk1.7.0_75 |
Linux | export JAVA_HOME=/usr/local/java-current |
Mac | export JAVA_HOME=/Library/Java/Home |
OS | Output |
---|---|
Windows | Append the string ;C:\Program Files\Java\jdk1.7.0_75\bin to the end of the system variable, Path. |
Linux | export PATH=$PATH:$JAVA_HOME/bin/ |
Mac | not required |
Step 3: Download Maven archive
Download Maven 3.3.3 from http://maven.apache.org/download.cgiOS | Archive name |
---|---|
Windows | apache-maven-3.3.3-bin.zip |
Linux | apache-maven-3.3.3-bin.tar.gz |
Mac | apache-maven-3.3.3-bin.tar.gz |
Step 4: Extract the Maven archive
Extract the archive, to the directory you wish to install Maven 3.3.3. The subdirectory apache-maven-3.3.3 will be created from the archive.OS | Location (can be different based on your installation) |
---|---|
Windows | C:\Program Files\Apache Software Foundation\apache-maven-3.3.3 |
Linux | /usr/local/apache-maven |
Mac | /usr/local/apache-maven |
No comments:
Post a Comment