#maven ##安装 使用homebrew,安装完之后,在终端中输入:
mvn -version
返回:
Apache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5; 2015-11-11T00:41:47+08:00)Maven home: /usr/local/Cellar/maven/3.3.9/libexecJava version: 1.8.0_40, vendor: Oracle CorporationJava home: /Library/Java/JavaVirtualMachines/jdk1.8.0_40.jdk/Contents/Home/jreDefault locale: zh_CN, platform encoding: UTF-8OS name: "mac os x", version: "10.11.4", arch: "x86_64", family: "mac"
这是我的电脑上的maven的一些信息 ##依赖特性 依赖传递
依赖选择:(最短路径原则和最先申明原则)
- A->B->C-X和A->D-X(最短路径原则)
- A->B->X和A->C->X(最短路径一样的话,使用最先申明原则)
##聚合和继承特性 聚合使用modules标签,例如:
common rest service persistence
继承使用parent标签
scaffold com.ctofunds 1.0-SNAPSHOT service
因为artifactId和父类中的不一样,所以重写。
##统一管理版本
使用properties标签,例如:
4.1.7.RELEASE org.springframework spring-core ${spring.version}
##例子
4.0.0 com.ctofunds scaffold pom 1.0-SNAPSHOT common rest service persistence 1.8 4.2.4.RELEASE UTF-8 4.3.5 com.google.code.gson gson 2.2.4 com.google.guava guava 18.0 org.slf4j slf4j-log4j12 1.7.13 org.apache.commons commons-lang3 3.3 commons-codec commons-codec 1.7 commons-logging commons-logging 1.1.3 org.apache.httpcomponents fluent-hc ${http.client.version} org.apache.httpcomponents httpclient ${http.client.version} org.apache.httpcomponents httpclient-cache ${http.client.version} org.apache.httpcomponents httpcore 4.3.2 org.apache.httpcomponents httpmime ${http.client.version} org.springframework spring-context ${spring.version} org.springframework spring-jdbc ${spring.version} org.springframework spring-test ${spring.version} org.springframework spring-orm ${spring.version} org.springframework spring-core ${spring.version} org.springframework spring-context-support ${spring.version} org.springframework spring-tx ${spring.version} org.springframework spring-webmvc ${spring.version} org.springframework spring-web ${spring.version} javax.servlet javax.servlet-api 3.0.1 org.mybatis mybatis 3.3.0 mysql mysql-connector-java 5.1.38 com.zaxxer HikariCP 2.4.3 joda-time joda-time 2.3 junit junit 4.11 net.lingala.zip4j zip4j 1.3.2 org.mybatis.spring.boot mybatis-spring-boot-starter 1.0.0 org.apache.maven.plugins maven-compiler-plugin 3.5
rest:
scaffold com.ctofunds 1.0-SNAPSHOT 4.0.0 war rest com.ctofunds common ${project.parent.version} com.ctofunds service ${project.parent.version} com.google.code.gson gson org.springframework spring-webmvc org.springframework spring-core org.springframework spring-web com.google.guava guava org.slf4j slf4j-log4j12 joda-time joda-time javax.servlet javax.servlet-api provided junit junit test maven-war-plugin 2.6 src/webapp false chameleon-api-web
common:
scaffold com.ctofunds 1.0-SNAPSHOT 4.0.0 common