download binary zip. Unzip it.
Append environment variables:
MAVEN_HOME, JDK_HOME.
Append to system path:
%MAVEN_HOME%\bin;%JDK_HOME%\bin;
Maven has dependency with JDK.
Test:
mvn -version
(pom.xml is maven config file.)
POM: Project Object Model.
**pom.xml **
UTF-8 Encoding uniform when maven compile source code.
<properties>
<project.build.sourceEncoding> UTF-8 </project.build.sourceEncoding>
</properties>
To a JDK version uniform of maven compiling and source code.
<build>
<plugins>
<!-- compile -->
<plugin>
<groupId> org.apache.maven.plugins </groupId>
<artifactId> maven-compile-plugin </artifactId>
<version> 3.3 </version>
<configuration>
<source> 1.8 </source> <!-- JDK version -->
<target> 1.8 </target>
</configuration>
</plugin>
</plugins>
</build>
To set output war package
<packaging> war </packaging>
Then you need servlet, jsp, JSTL dependencies.
<dependencies>
<dependency>
<groupId> javax.servlet </groupId>
<artifactId>servlet-api </artifactId>
<version> RELEASE </version>
<scope> provided </scope> <!-- tomcat will provide. -->
</dependency>
<dependency>
<groupId> javax.servlet </groupId>
<artifactId> jstl </artifactId>
<version>1.2</version>
<scope> runtime </scope> <!-- needed when running, don't need to compile. -->
</dependency>
<dependency>
<groupId>javax.servlet.jsp </groupId>
<artifactId>jsp-api </artifactId>
<version>2.0</version>
<scope> provided </scope> <!-- tomcat will provide. -->
</dependency>
</dependencies>
</br>
Maybe you need tomcat plugin.
To run tomcat plugin, open maven board-plugins, double click tomcat7:run command, and then tomcat will be running. (or mvn tomcat8:run in cmd)
<!-- in build-plugins -->
<plugin>
<groupId> org.apache.tomcat.maven </groupId>
<artifactId>tomcat8-maven-plugin </artifactId>
<version> </version>
<configuration>
<path> /${project.artifactId} </path>
</configuration>
</plugin>
To Git
add git .gitignore file
#maven#
target/
#IDEA#
.idea/
*.iml
#Eclipse#
.settings/
.metadata/
.classpath/
.project
Servers/