Can I install the mysql jqbc connector using mvn install: install-file?

I want to install the JDBC connector using maven.

I have the following: mvn install: install-file -DgroupId = mysql -DartifactId = mysql-connnector-java -Dversion = 5.1.6 -Dpackaging = jar -Dfile = -DgenerationPom = true

I think that all I need is what I put on the other side = Dfile =?

I haven't used maven either, so I'm not sure what the file switcher is used for?

Thank you for understanding!

+7
source share
2 answers

Install-file or deploy-file targets are used to install or deploy artifacts in a local or internal repository that are not available in Maven Central or other external repositories that you could configure.

If you have access to Maven Central, just add the following to your pom.xml project:

<dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> <version>5.1.6</version> </dependency> 

... should do the trick.

To answer your question, the -Dfile = argument is for specifying an artifact that will actually be installed in the local repository.

+20
source

the lot answer is correct and that should be enough

But, if you want to use the latest version of the connector, you can check https://mvnrepository.com/artifact/mysql/mysql-connector-java

Add the following to your pom.xml project:

 <dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> <version>6.0.6</version> </dependency> 
0
source

All Articles