Add this plugin to the pom.xml of the project
<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>fuck</groupId>
<artifactId>notGood</artifactId>
<version>0.0.1-snapshot</version>
<packaging>jar</packaging>
<name>notGood</name>
<url>http://maven.apache.org</url>
<repositories>
<repository>
<id> central</id>
<name> Maven Repository switchboard</name>
<layout>default</layout>
<url>http://repo1.maven.org/maven2</url>
</repository>
</repositories>
<properties>
<project.build.sourceencoding>utf-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-core</artifactId>
<version>1.2.1</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.2</version>
<configuration>
<archive>
<manifest>
<mainClass>fuck.notGood.JobRun</mainClass>
</manifest>
</archive>
<descriptorRefs>
<descriptorRef>
Jar-with-dependencies
</descriptorRef>
</descriptorRefs>
</configuration>
</plugin>
</plugins>
</build>
</project>
Note Modify the entry class file MainClass to Main
<mainClass>fuck.notGood.JobRun</mainClass>
Add this assmbly plugin to hit the jar pack. In Eclipse, right-click the project run As->maven build to enter assembly:assembly in goals .
after successful execution, a jar package with-jar-with-dependencies end is given in the target folder. This jar package contains the class of all the jars on which the project depends .
Maven hits the project into a jar package