原因分析:
在META-INF中没有Main-Class属性。在启动的时候找不到启动方法。
解决方法:
在pom.xml中添加如下插件,指定启动类
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>1.2.1</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>com.abc.test.App</mainClass>
</transformer>
</transformers>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
其中com.abc.test.App是包名。
网上说的 META-INF不能放在src/java 文件夹这种解决方法似乎没有作用,也没有依据