Maven dependency for mysql - Version 5.1.2 of mysql-connector-java released
The developers of mysql - mysql-connector-java project have released the latest version of this library on 20 Apr 2015, the released version of mysql - mysql-connector-java library is 5.1.2. Developer can use this version ( mysql - mysql-connector-java version 5.1.2 ) in their Java project if it is based on Maven and Gradle.
How to use mysql - mysql-connector-java version 5.1.2 in project?
Steps to use mysql - mysql-connector-java version 5.1.2 in Java projects. Follow the step by step tutorial for using the latest version of mysql - mysql-connector-java in your Maven/Gradle project.
Step 1: Create or use a Maven project
First of all you have to create a new Java project based on maven project management tool if you don't have any previous project. You can download the simple project from Sample Maven project. You can import the sample project in Eclipse IDE or you can open your project in Eclipse or in any other IDE of your choice.
Step 2: Include the maven dependency of mysql - mysql-connector-java version 5.1.2
Now the next step is to use the latest dependency for maven of the mysql - braid library library in the pom.xml fie of your project. You have to copy the code given below:
<dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> <version>5.1.2</version> </dependency>
Above code is the maven dependency code that downloads and includes mysql - mysql-connector-java version 5.1.2 java library in your project.
Now you can save the file in Eclipse and then Eclipse will call maven tool for downloading the jar files. Once the jar files are downloaded it will be included in the project and you will be able to use mysql - mysql-connector-java version 5.1.2 library in your project.
Step 3: Now you are ready to use the mysql - mysql-connector-java version 5.1.2 in your project
Now you will be able to import the library in your project and use it.
Step 4: Finding the maven dependency tree
Sometimes it is required to check the dependency tree of the maven project to find out the jar conflicts, then you can use the Maven dependency plugin. The Maven dependency plugin is used to list down the the dependency in the project. The dependency:tree option of the mvn command line tool can be used to see the dependency tree of the given project. After adding the Maven dependency of mysql - mysql-connector-java version 5.1.2 in your pom.xml file you can run following command on the terminal:
Above command will list down the dependency of your project. This way you will be able to find out any jar conflict issue of the project.
If you project is based on Gradle then you can use following dependency code:
implementation group: 'mysql', name: 'mysql-connector-java', version: '5.1.2'
Above code will enable the Gradle to down mysql - mysql-connector-java dependency jar and include in the project.
You can read more at: