Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

mysql

maven

jdbc

I'd like 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 all I'm need is what I put on the other side of the =Dfile= ?

I haven't used maven in a while either, so I'm not sure what the file switch is used for?

Thanks for all the insight!

like image 244
user2197446 Avatar asked Mar 22 '13 01:03

user2197446


2 Answers

The "install-file" or "deploy-file" goals are used for installing or deploying artifacts to your local or internal repository that are not available from Maven Central or other external repositories that you may have configured.

If you've got access to Maven Central, simply adding the following to your project's pom.xml:

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

...should do the trick.

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

like image 88
lotz Avatar answered Nov 13 '22 02:11

lotz


lotz answer is right and that should be sufficient

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 project's pom.xml:

<dependency>
  <groupId>mysql</groupId>
  <artifactId>mysql-connector-java</artifactId>
  <version>6.0.6</version>
</dependency>
like image 2
Utkarsh Gupta Avatar answered Nov 13 '22 03:11

Utkarsh Gupta