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

前端 未结 5 417
旧巷少年郎
旧巷少年郎 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:51

    I had this problem as well. I tried using plugins to set the connector to classpath but it didn't work. I tried to change versions, it didn't work. I've spent two nights to find out that i needed to specify in pom.xml that i need my package to be a "war".

    Maybe it's because your project doesn't know what type it is, so try to put this:

    war
    

    right next to your project version. Something like this:

    
    
    4.0.0
    
    com.example
    example-app
    1.0-SNAPSHOT
    war 
    
    
        
    
    
    
        
    
    

    Maybe it doesn't suit your problem, but maybe somebody else will need it.

提交回复
热议问题