<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-assembly-plugin</artifactId> <version>2.4</version> <configuration> <appendAssemblyId>false</appendAssemblyId> <finalName>searchIndex</finalName> <descriptorRefs> <!-- 将依赖的jar包中的class文件打进生成的jar包--> <descriptorRef>jar-with-dependencies</descriptorRef> </descriptorRefs> <archive> <manifest> <addClasspath>true</addClasspath> <!-- 有Main函数的类--> <mainClass>com.yourcompany.yourproject.MainClass</mainClass> </manifest> </archive> </configuration> <executions> <execution> <id>make-assembly</id> <phase>package</phase> <goals> <!-- <goal>single</goal>--> <goal>assembly</goal> </goals> </execution> </executions> </plugin>