首页 > 代码库 > mvn使用记录
mvn使用记录
1. mvn dependency:copy-dependencies
会导出到targed/dependency 下面
2. mvn dependency:copy-dependencies -DoutputDirectory=lib
这样jar包都会copy到工程目录下的lib里面
3. 设置依赖级别,通常用编译需要的jar
mvn dependency:copy-dependencies -DoutputDirectory=lib -DincludeScope=compile
4. mvn -DskipTests clean package // test 可编译,仅跳过测试
5. mvn -Dmaven.test.skip=true clean package // test 不编译,也跳过测试
?6. 配置全部跳过
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
7. 引入本地包:
<dependency>
<groupId>com.*.*</groupId>
<artifactId>tinder</artifactId>
<version>1.0</version>
<scope>system</scope>
<systemPath>${basedir}/lib/tinder.jar</systemPath>
</dependency>
8. 资源过滤
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
<resource>
<directory>src/test/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
9. 编译:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
<encoding>UTF-8</encoding>
<excludes>
<exclude>**/sdh/**</exclude>
</excludes>
<testExcludes>
<testExclude>**/sdh/**</testExclude>
</testExcludes>
</configuration>
</plugin>