jar 运行报错

  jar 运行

java -cp hello-1.0-SNAPSHOT-jar-with-dependencies.jar hello.App

  报错

      貌似没有把依赖打包 ,pom引入

        <plugin>
          <artifactId>maven-assembly-plugin</artifactId>
          <configuration>
            <descriptorRefs>
              <descriptorRef>jar-with-dependencies</descriptorRef>
            </descriptorRefs>
          </configuration>
        </plugin>

   再运行

mvn assembly:assembly

   打包成功的话,生成  xxx-jar-with-dependencies.jar 带依赖包的 jar 

   

原文地址:https://www.cnblogs.com/Jomini/p/12299492.html