问答详情
源自:3-5 Hello Spring MVC

pom.xml里的properties是干什么用的,里面的东西又是干什么的


<properties>        <spring.version>4.1.3.RELEASE</spring.version>        <slf4j.version>1.7.5</slf4j.version>        <commons-lang.version>2.6</commons-lang.version>    </properties>

提问者:慕粉4039862 2016-12-20 15:19

个回答

  • OnWork
    2016-12-25 15:48:13

    统一管理版本号

    <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

    <modelVersion>4.0.0</modelVersion>

    <groupId>tk.liaohongdong</groupId>

    <artifactId>myResume</artifactId>

    <version>0.0.1-SNAPSHOT</version>

    <!-- 定义版本号 -->

    <properties>

    <junit.version>4.12</junit.version>

    <commons.lang.version>2.6</commons.lang.version>

    <commons.io.version>2.5</commons.io.version>

    <commons.net.version>3.5</commons.net.version>

    <commons.fileupload.version>1.3.1</commons.fileupload.version>

    <jackson.databind.version>2.8.5</jackson.databind.version>

    <httpclient.version>4.5.2</httpclient.version>

    <joda.time.version>2.9.6</joda.time.version>

    <slf4j.log4j12.version>1.7.21</slf4j.log4j12.version>

    <mysql.version>5.1.40</mysql.version>

    <mybatis.version>3.4.1</mybatis.version>

    <mybatis.spring.version>1.3.0</mybatis.spring.version>

    <pagehelper.version>4.2.1</pagehelper.version>

    <druid.version>1.0.27</druid.version>

    <spring.version>4.3.4.RELEASE</spring.version>

    <jstl.version>1.2</jstl.version>

    <servlet.api.version>2.5</servlet.api.version>

    <jsp.api.version>2.2</jsp.api.version>

    <jedis.version>2.8.2</jedis.version>

    <solr.solrj.version>6.2.1</solr.solrj.version>

    <httpcore.version>4.4.5</httpcore.version>

    </properties>

    <dependencies>

    <!-- 单元测试工具 -->

    <!-- https://mvnrepository.com/artifact/junit/junit -->

    <dependency>

    <groupId>junit</groupId>

    <artifactId>junit</artifactId>

    <version>${junit.version}</version>

    </dependency>

    <!-- Json解析工具 -->

    <!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-databind -->

    <dependency>

    <groupId>com.fasterxml.jackson.core</groupId>

    <artifactId>jackson-databind</artifactId>

    <version>${jackson.databind.version}</version>

    </dependency>

    <!-- 日期处理工具 -->

    <!-- https://mvnrepository.com/artifact/joda-time/joda-time -->

    <dependency>

    <groupId>joda-time</groupId>

    <artifactId>joda-time</artifactId>

    <version>${joda.time.version}</version>

    </dependency>

    <!-- 日志处理 -->

    <!-- https://mvnrepository.com/artifact/org.slf4j/slf4j-log4j12 -->

    <dependency>

    <groupId>org.slf4j</groupId>

    <artifactId>slf4j-log4j12</artifactId>

    <version>${slf4j.log4j12.version}</version>

    </dependency>

    <!-- Redis客户端 -->

    <!-- https://mvnrepository.com/artifact/redis.clients/jedis -->

    <!-- <dependency>

    <groupId>redis.clients</groupId>

    <artifactId>jedis</artifactId>

    <version>${jedis.version}</version>

    </dependency> -->

    <!-- solr客户端 -->

    <!-- https://mvnrepository.com/artifact/org.apache.solr/solr-solrj -->

    <!-- <dependency>

    <groupId>org.apache.solr</groupId>

    <artifactId>solr-solrj</artifactId>

    <version>${solr.solrj.version}</version>

    </dependency> -->




    <!-- apache 工具 -->

    <!-- https://mvnrepository.com/artifact/commons-lang/commons-lang -->

    <dependency>

    <groupId>commons-lang</groupId>

    <artifactId>commons-lang</artifactId>

    <version>${commons.lang.version}</version>

    </dependency>

    <!-- https://mvnrepository.com/artifact/org.apache.httpcomponents/httpcore -->

    <dependency>

    <groupId>org.apache.httpcomponents</groupId>

    <artifactId>httpcore</artifactId>

    <version>${httpcore.version}</version>

    </dependency>

    <!-- https://mvnrepository.com/artifact/commons-io/commons-io -->

    <dependency>

    <groupId>commons-io</groupId>

    <artifactId>commons-io</artifactId>

    <version>${commons.io.version}</version>

    </dependency>

    <!-- https://mvnrepository.com/artifact/commons-net/commons-net -->

    <dependency>

    <groupId>commons-net</groupId>

    <artifactId>commons-net</artifactId>

    <version>${commons.net.version}</version>

    </dependency>

    <!-- https://mvnrepository.com/artifact/commons-fileupload/commons-fileupload -->

    <dependency>

    <groupId>commons-fileupload</groupId>

    <artifactId>commons-fileupload</artifactId>

    <version>${commons.fileupload.version}</version>

    </dependency>

    <!-- https://mvnrepository.com/artifact/org.apache.httpcomponents/httpclient -->

    <dependency>

    <groupId>org.apache.httpcomponents</groupId>

    <artifactId>httpclient</artifactId>

    <version>${httpclient.version}</version>

    </dependency>



    <!-- Mybatis -->

    <!-- https://mvnrepository.com/artifact/org.mybatis/mybatis -->

    <!-- <dependency>

    <groupId>org.mybatis</groupId>

    <artifactId>mybatis</artifactId>

    <version>${mybatis.version}</version>

    </dependency> -->

    <!-- https://mvnrepository.com/artifact/org.mybatis/mybatis-spring -->

    <!-- <dependency>

    <groupId>org.mybatis</groupId>

    <artifactId>mybatis-spring</artifactId>

    <version>${mybatis.spring.version}</version>

    </dependency> -->

    <!-- 分页工具 -->

    <!-- https://mvnrepository.com/artifact/com.github.pagehelper/pagehelper -->

    <!-- <dependency>

    <groupId>com.github.pagehelper</groupId>

    <artifactId>pagehelper</artifactId>

    <version>${pagehelper.version}</version>

    </dependency> -->



    <!-- 数据库 -->

    <!-- https://mvnrepository.com/artifact/mysql/mysql-connector-java -->

    <dependency>

    <groupId>mysql</groupId>

    <artifactId>mysql-connector-java</artifactId>

    <version>${mysql.version}</version>

    </dependency>

    <!--连接池 -->

    <!-- https://mvnrepository.com/artifact/com.alibaba/druid -->

    <dependency>

    <groupId>com.alibaba</groupId>

    <artifactId>druid</artifactId>

    <version>${druid.version}</version>

    </dependency>



    <!-- spring -->

    <!-- https://mvnrepository.com/artifact/org.springframework/spring-context -->

    <dependency>

    <groupId>org.springframework</groupId>

    <artifactId>spring-context</artifactId>

    <version>${spring.version}</version>

    </dependency>

    <!-- https://mvnrepository.com/artifact/org.springframework/spring-webmvc -->

    <dependency>

    <groupId>org.springframework</groupId>

    <artifactId>spring-webmvc</artifactId>

    <version>${spring.version}</version>

    </dependency>

    <!-- https://mvnrepository.com/artifact/org.springframework/spring-beans -->

    <dependency>

    <groupId>org.springframework</groupId>

    <artifactId>spring-beans</artifactId>

    <version>${spring.version}</version>

    </dependency>

    <!-- https://mvnrepository.com/artifact/org.springframework/spring-jdbc -->

    <dependency>

    <groupId>org.springframework</groupId>

    <artifactId>spring-jdbc</artifactId>

    <version>${spring.version}</version>

    </dependency>

    <!-- https://mvnrepository.com/artifact/org.springframework/spring-aspects -->

    <dependency>

    <groupId>org.springframework</groupId>

    <artifactId>spring-aspects</artifactId>

    <version>${spring.version}</version>

    </dependency>



    <!-- jsp -->

    <!-- https://mvnrepository.com/artifact/javax.servlet/jstl -->

    <dependency>

    <groupId>javax.servlet</groupId>

    <artifactId>jstl</artifactId>

    <version>${jstl.version}</version>

    </dependency>

    <!-- https://mvnrepository.com/artifact/javax.servlet/servlet-api -->

    <dependency>

    <groupId>javax.servlet</groupId>

    <artifactId>servlet-api</artifactId>

    <version>${servlet.api.version}</version>

    </dependency>

    <!-- https://mvnrepository.com/artifact/javax.servlet.jsp/jsp-api -->

    <dependency>

    <groupId>javax.servlet.jsp</groupId>

    <artifactId>jsp-api</artifactId>

    <version>${jsp.api.version}</version>

    </dependency>


    </dependencies>

    </project>

    这样,下面就可以使用变量的是形式来管理这个版本号

  • ChuangWin
    2016-12-20 16:35:41

    1. 老师将要依赖的所有jar包的版本标签全放到了<properties> 标签下,方便maven依赖标签动态获取版本号,用${properties中的标签}来获取,里面的这些全是jar包的版本号。

    2.maven依赖标签中需要各个jar包的版本号。