As subject, sometimes, we can not find some jars in Maven centre repository, so we should add them into our local repository.
Steps:
- Download jar from offical web site.
for example, I download mysql jdbc driver from oracle, and put the jar into my disk, path: D:\apache-maven-3.3.3\mavenRepository\mysql\mysql-connector-java\5.1.36-bin
- Install the jar
execute following commend:
run cmd
cd: d:
cd: D:\apache-maven-3.3.3\mavenRepository\mysql\mysql-connector-java\5.1.36-bin
mvn install:install-file -Dfile=mysql-connector-java-5.1.36-bin.jar -DgroupId=mysql -DartifactId=mysql-connector-java -Dversion=5.1.36-bin -Dpackaging=jar.
Here you will run into an error, say there is no project, missing a pom, if your commend is:
mvn install:install-file -Dfile=D:\apache-maven-3.3.3\mavenRepository\mysql\mysql-connector-java\5.1.36-bin\mysql-connector-java-5.1.36-bin.jar -DgroupId=mysql -DartifactId=mysql-connector-java -Dversion=5.1.36-bin -Dpackaging=jar.
error screen is
only difference is -Dfile should not contains full path, if you want to install the jar, enter into the fold where your jar is in.