一:
maven 打带依赖的jar 包:
在pom.xml中添加plugin
<build>然后 :选中项目 run as --> maven bulid -->填入下图红框中的命令 (myeclipse 中 命令前加 mvn
<plugins>
<!--打jar 带依赖 -->
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<archive>
<manifest>
<!--带main方法的话要指定main的入口 -->
<mainClass>com.yt.distincttask.MainDistinctTask.Main</mainClass>
</manifest>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
</plugin>
<!--打源码包 -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.0.2</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<artifactId>maven-source-plugin</artifactId>
<version>2.1</version>
<configuration>
<attach>true</attach>
</configuration>
<executions>
<execution>
<!-- 在maven的compile 阶段就开始打包 -->
<phase>compile</phase>
<goals>
<!-- 源码单独作为一个jar包 -->
<goal>jar</goal>
<!--源码打进jar包中 类似执行mvn source:jar -->
<!-- <goal>jar-no-fork</goal> -->
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>