maven的pom.xml打包配置

 <build>
    <plugins>
    <!-- 指定maven编译的jdk版本,如果不指定,maven3默认用jdk 1.5 maven2默认用jdk1.3 -->
    <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-compiler-plugin</artifactId>
    <version>2.3.2</version>
    <configuration>
    <!-- 一般而言,target与source是保持一致的,但是,有时候为了让程序能在其他版本的jdk中运行
    (对于低版本目标jdk,源代码中不能使用低版本jdk中不支持的语法),会存在target不同于source的情况 -->
    <source>1.8</source> <!-- 源代码使用的JDK版本 -->
    <target>1.8</target> <!-- 需要生成的目标class文件的编译版本 -->
    <encoding>UTF-8</encoding><!-- 字符集编码 -->
    <verbose>true</verbose>
    <!--<showWarnings>true</showWarnings>-->
    <!-- 要使compilerVersion标签生效,还需要将fork设为true,用于明确表示编译版本配置的可用 -->
    <!--<fork>true</fork>-->
    <!-- 使用指定的javac命令,例如:<executable>${JAVA_1_4_HOME}/bin/javac</executable> -->
    <!-- <executable>path-to-javac </executable>-->
    <!-- 指定插件将使用的编译器的版本 -->
    <!--<compilerVersion>1.3</compilerVersion>-->
    <!-- 编译器使用的初始内存 -->
    <!--<meminitial>128m</meminitial>-->
    <!-- 编译器使用的最大内存 -->
    <!--<maxmem>512m</maxmem>-->
    <!-- 这个选项用来传递编译器自身不包含但是却支持的参数选项 -->
    <!--<compilerArgument>-verbose -bootclasspath ${java.home}lib
t.jar</compilerArgument>-->
    </configuration>
    </plugin>

    <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId> maven-assembly-plugin </artifactId>
    <configuration>
    <!-- 使用Maven预配置的描述符-->
    <descriptorRefs>
    <descriptorRef>jar-with-dependencies</descriptorRef>
    </descriptorRefs>
    </configuration>
    <executions>
    <execution>
    <id>make-assembly</id>
    <!-- 绑定到package生命周期 -->
    <phase>package</phase>
    <goals>
    <!-- 只运行一次 -->
    <goal>single</goal>
    </goals>
    </execution>
    </executions>
    </plugin>
    </plugins>
    </build>
原文地址:https://www.cnblogs.com/zyanrong/p/12738689.html