Maven - java.lang.ClassNotFoundException: com.mysql.jdbc.Driver

前端 未结 5 405
旧巷少年郎
旧巷少年郎 2020-12-10 04:58

I have a Java app based on Maven, and want to connect to MySQL server.

My pom has:


    mysql
    &l         


        
5条回答
  •  不思量自难忘°
    2020-12-10 05:53

    The answer is here - How can I create an executable JAR with dependencies using Maven?

    I needed to build an uber pom, using the answer in the link above - this builds in the dependencies (in this case the mysql jar file) into a single SNAPSHOT jar file.

    Just make sure you run it with mvn clean compile assembly:single (not the usual mvn clean package or whatever.

提交回复
热议问题