Maven
常用命令
mvn -version
mvn comple
mvn clean
mvn test
mvn package
mvn install
mvn clean install
scope 依赖范围
compile 默认编译依赖范围编译、测试、运行都有效
test 测试范围有效
provided 对编译、测试有效,运行无效
依赖传递
compile 当第二依赖的范围是compile的时候,依赖可以传递
test 当第二直接依赖的范围是test的时候,依赖不会得以传递
provided和runtime 少见
依赖冲突
Maven依照就近依赖原则
<optional> true/false<optional> 是否向下传递
exclusions 可用于排除依赖,注意exclusions是写在dependency中
tomcat插件
<build>
<plugins>
<plugin>
<!-- 配置插件tomcat7 -->
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<configuration>
<port>8080</port>
<path>/</path>
</configuration>
</plugin>
</plugins>
</build>