Maven_pom.xml
简单的配置实例:
<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>TheFirsttestMaven</groupId>
<artifactId>TheFirsttestMaven</artifactId>
<version>0.0.1-SNAPSHOT</version>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>2.1</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>FirstDemo</mainClass>
</transformer>
</transformers>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
表 1 -2 Maven 编译命令
命 令 含 义
mvn clean 清理编译结果
mvn compile [-Pnative] 编译源代码
mvn test [-Pnative] 运行测试程序
mvn package 创建 JAR 包
mvn compile findbugs:findbugs 运行 findbugs
mvn compile checkstyle:checkstyle 运行 checkstyle( 检查编程规范)
mvn install 将 JAR 包放到 M2 缓存中
mvn deploy 将 JAR 部署到 Maven 仓库中
mvn package [-Pdist][-Pdocs][-Psrc][-Pnative][-Dtar] 构建发布版
mvn versions:set -DnewVersion=NEWVERSION 修改 Hadoop 版本