Maven Add dependency manually (Oracle JDBC as an example)

Source: Internet
Author: User

Because of Oracle licensing issues, MAVEN does not provide Oracle JDBC driver, which must be manually added to the local warehouse in order to apply the Oracle JDBC driver in the MAVEN project.
First, you need to download the OJDBC jar package to the Oracle official website.
Http://www.oracle.com/technetwork/database/features/jdbc/default-2280470.html
I chose Ojdbc7.jar, the corresponding version is 12.1.0.2.
Ojdbc7.jar (3,698,857 bytes)-(SHA1 checksum:7c9b5984b2c1e32e7c8cf3331df77f31e89e24c2)
For use with JDK 7; It contains the JDBC driver classes except classes for NLS support in Oracle Object and Collection types.
Note that Ojdbc7.jar is used on JDK 7, but it seems that Ojdbc6.jar can also be used on JDK 7.

I then save the downloaded Ojdbc7.jar in the ~/additional_jars/directory.
Run:
MVN install:install-file-dgroupid=com.oracle-dartifactid=ojdbc7-dversion=12.1.0.2-dpackaging=jar-dfile=~/ Additional_jars/ojdbc7.jar
Then an error occurs, so I CD to the ~/additional_jars/directory and then run:
MVN install:install-file-dgroupid=com.oracle-dartifactid=ojdbc7-dversion=12.1.0.2-dpackaging=jar-dfile= Ojdbc7.jar
Then it's still a mistake.
Later I found the cause of the error because I was under windows and I ran this section of the program on the GIT command line that was opened.
Open the Windows command-line interface, enter the ~/additional_jars/directory, and then run:
MVN install:install-file-dgroupid=com.oracle-dartifactid=ojdbc7-dversion=12.1.0.2-dpackaging=jar-dfile= Ojdbc7.jar
Show "BUILD SUCCESS".

You can then add dependency to the MAVEN project, and the coordinates correspond to the elements of the command above, as follows:
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc7</artifactId>
<version>12.1.0.2</version>
</dependency>

Maven Add dependency manually (Oracle JDBC as an example)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.