Maven project failed to add mysql-connector-java dependency dependency 'mysql-connector-java' not found

To build a Scala project in IDEA, the processed data needs to be stored in the local mysql database, so it is necessary to add the mysql-connector-java dependency package to Maven's pom.xml, which may be because I changed the AS project in C when I migrated it before. The .m2 warehouse file in the User directory of the disk cannot directly download the corresponding jar from the default Maven warehouse. .

There is no way, you can only download the jar yourself and put it in the .m2 warehouse. .

I put the mysql-connector-java-8.0.19.zip I used in my Baidu network disk, and I can pick it up if I need it.

(CSDN download really pit)

Link: Click here to download ;

Extraction code: 666j

Unzip as follows:

insert image description here

The red circle is the required mysql-connector-java dependency jar, which can be decompressed.

At this time, the pom.xml of the Maven project will still have a red name error, and the project dependency structure needs to be configured as follows.

If you want to manually add Maven dependencies in the following format

insert image description here

The following directory structure needs to be created under the .m2 folder:
① mysql
② mysql-connector-java
③ 8.0.19
④ mysql-connector-java-8.0.19.jar [ source file ]

As shown in the figure:

insert image description here

Rebuild again and use spicy happily!

Guess you like

Origin blog.csdn.net/m0_54850467/article/details/123659401