maven打包jar时,自动添加mainClass和复制依赖的其他jar,红色部分指定
<build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <configuration> <source>1.8</source> <target>1.8</target> </configuration> </plugin> <plugin> <artifactId>maven-assembly-plugin</artifactId> <configuration> <descriptorRefs> <descriptorRef>jar-with-dependencies</descriptorRef> </descriptorRefs> <archive> <manifest> <mainClass>microservice.javaapp.histclient.HelloWorldMaven</mainClass> </manifest> </archive> </configuration> </plugin> </plugins> </build>