第三种 打依赖包 将依赖其他jar的包都打进去
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.4</version>
<configuration>
<descriptors>
<descriptor>src/main/assembly/src.xml</descriptor>
</descriptors>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
<executions>
<execution>
<id>make-assembly</id> <!-- this is used for inheritance merges -->
<phase>package</phase> <!-- bind to the packaging phase -->
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.13</version>
<configuration>
<useFile>false</useFile>
<disableXmlReport>true</disableXmlReport>
可以直接声明主类
<!-- If you have classpath issue like NoDefClassError,... -->
<!-- useManifestOnlyJar>false</useManifestOnlyJar -->
<includes>
<include>**/*Test.*</include>
<include>**/*Suite.*</include>
</includes>
</configuration>
</plugin> 第二种
<!--<plugin>-->
<!--<!– 将第三方的依赖包,一起打入到最终形成的jar文件中 –>-->
<!--<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>com.bigdata.bokong.offline.SmartAuditStat</mainClass>-->
<!--</transformer>-->
<!--</transformers>-->
<!--<!–<transformers>–>-->
<!--<!–<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">–>-->
<!--<!–<mainClass>com.wondertek.bigdata.offline.service.converter.server.DimensionConverterServer</mainClass>–>-->
<!--<!–</transformer>–>-->
<!--<!–</transformers>–>-->
<!--<!–<artifactSet>-->
<!--<includes>-->
<!--<include>cz.mallat.uasparser:uasparser</include>-->
<!--<include>net.sourceforge.jregex:jregex</include>-->
<!--<include>mysql:mysql-connector-java</include>-->
<!--</includes>-->
<!--</artifactSet>–>-->
<!--<filters>-->
<!--<filter>-->
<!--<artifact>*:*</artifact>-->
<!--<excludes>-->
<!--<exclude>META-INF/*.SF</exclude>-->
<!--<exclude>META-INF/*.DSA</exclude>-->
<!--<exclude>META-INF/*.RSA</exclude>-->
<!--</excludes>-->
<!--</filter>-->
<!--</filters>-->
<!--</configuration>-->
<!--</execution>-->
<!--</executions>-->
<!--</plugin>-->
</plugins>