Maven

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/
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • 我jdk版本是1.7.0_95,在网上查了一下1.7属于java7maven3.3+版本都支持java7,所以我使...
    liangxifeng833阅读 1,297评论 0 2
  • Spring Cloud为开发人员提供了快速构建分布式系统中一些常见模式的工具(例如配置管理,服务发现,断路器,智...
    卡卡罗2017阅读 134,923评论 18 139
  • 所有项目的构建都是有生命周期的,这个生命周期包括:项目清理、初始化、编译、测试、打包、集成测试、验证、部署、站点生...
    zlcook阅读 2,822评论 0 21
  • 当前,JVM生态圈主要的三大构建工具: Apache Ant(带着Ivy) Maven Gradle 对于刚开始接...
    清枫_小天阅读 5,834评论 1 13
  • 射雕英雄传的电视剧有很多版本,以前的也看过一些,最近出了新版的,感觉拍的不怎么样,但是我始终是喜欢里面的剧情和人物...
    HCYY阅读 358评论 0 0