1.jar在maven中
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>1.4</version>
<configuration>
<createDependencyReducedPom>true</createDependencyReducedPom>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<transformers>
<transformer
implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<!-- 启动类的路径 --><mainClass>cn.hylexus.jt808.server.TCPServer</mainClass>
</transformer>
</transformers>
</configuration>
</execution>
</executions>
</plugin>
2.jar在lib中
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.4</version>
<configuration>
<archive>
<addMavenDescriptor>false</addMavenDescriptor>
<manifest>
<addClasspath>true</addClasspath>
<!-- jar包的位置 -->
<classpathPrefix>lib/</classpathPrefix>
<!-- 启动类路劲 -->
<mainClass>com.yourClass</mainClass>
</manifest>
</archive>
过滤掉不希望包含在jar中的文件
<excludes>
<exclude>${project.basedir}/xml/*</exclude>
</excludes>
</configuration>
</plugin>
上面两种都要配置idea的下面我们来配置一下
最后clean,package就好了