2

I am having an issue in which IntelliJ is not recognising the mysql-connector dependency in my pom.xml file. It appears as red and displays 'Dependency 'mysql:mysql-connector-java:8.0.25' not found'. I don't have to download anything, do I? Is declaring the dependency in pom.xml enough? I am also getting the same for the maven-failsafe-plugin.

My pom.xml file dependency:

<dependency>
    <groupId>mysql</groupId>
    <artifactId>mysql-connector-java</artifactId>
    <version>8.0.25</version>
    <scope>compile</scope>
</dependency>

If anyone has any suggestions, they would be greatly appreciated.

JohnSA
  • 55
  • 1
  • 6
  • 1
    That should work, Maven will automatically download the necessary library when you build it. Try building the project with Maven (`mvn clean install`, or by clicking it in the Maven panel in IntelliJ). – Jesper Mar 02 '22 at 15:47
  • Thank you, reloading the project with maven fixed the issue! – JohnSA Mar 02 '22 at 16:06
  • Find the answer in here (as @Jesper comment)? [Import Maven dependencies in IntelliJ IDEA](https://stackoverflow.com/questions/11454822/import-maven-dependencies-in-intellij-idea) – Lunatic Mar 02 '22 at 16:11

1 Answers1

3

I think they have recently changed in dependency MySQL. My issue was resolved by adding the below dependency.You can also try it

<dependency>
<groupId>com.mysql</groupId>
<artifactId>mysql-connector-j</artifactId>
</dependency>