java -jar 和 java -cp 的区别
https://blog.csdn.net/weixin_38653290/article/details/84647019
1.pom中build指定mainClass 但是 META-INF\MANIFEST.MF文件中没有指定Main-Class: test.core.Core
java -jar test-jar-with-dependencies.jar //执行成功
java -cp test-jar-with-dependencies.jar test.core.Core //执行失败,提示jar中没有主清单属性
2.pom中build没有指定mainClass 但是 META-INF\MANIFEST.MF文件中指定了Main-Class: test.core.Core
java -jar test-jar-with-dependencies.jar //执行失败,提示jar中没有主清单属性
java -cp test-jar-with-dependencies.jar test.core.Core //执行成功
3.pom中build指定mainClass && META-INF\MANIFEST.MF文件中增加了Main-Class: test.core.Core
java -cp test-jar-with-dependencies.jar test.core.Core //执行成功
java -jar test-jar-with-dependencies.jar //执行成功