Because of Oracle's commercial copyright issues, maven cannot download the jar package directly from the central repository, and if you want to use a jar package, you need to handle it manually.
The first step: Put Ojdbc14.jar in the user directory, for example: C:\Users\qicyt1812
Step Two: Execute the command in cmd: mvn install:install-file-dgroupid=com.oracle-dartifactid=ojdbc14-dversion=10.2.0.1.0- Dpackaging=jar-dfile=ojdbc14.jar
C:\Users\ qicyt1812 >MVN INSTALL:INSTALL-FILE-DGROUPID=COM.ORACLE-DARTIFACTID=OJDBC1 4-dversion=10.2.0.1.0-dpackaging=jar-dfile=ojdbc14.jar |
This installs the JDBC driver into the MAVEN local repository, and when the following code appears in the CMD command, the installation is successful.
C:\USERS\QICYT1812>MVN INSTALL:INSTALL-FILE-DGROUPID=COM.ORACLE-DARTIFACTID=OJDBC1 4-dversion=10.2.0.1.0-dpackaging=jar-dfile=ojdbc14.jar [INFO] Scanning for projects ... [INFO] [INFO]------------------------------------------------------------------------ [INFO] Building Maven Stub Project (No POM) 1 [INFO]------------------------------------------------------------------------ [INFO] [INFO]---maven-install-plugin:2.3.1:install-file (default-cli) @ Standalone-po M--- [INFO] Installing C:\Users\qicyt1812\ojdbc14.jar to D:\eclipse\apache-maven-local-re Pository\com\oracle\ojdbc14\10.2.0.1.0\ojdbc14-10.2.0.1.0.jar [INFO]------------------------------------------------------------------------ [INFO]BUILD SUCCESS [INFO]------------------------------------------------------------------------ [INFO] Total time:1.100s [INFO] Finished At:fri Oct 14:24:18 CST 2013 [INFO] Final memory:6m/53m [INFO]------------------------------------------------------------------------ |
Enter D:\eclipse\apache-maven-local-repository\com\oracle\ojdbc14\10.2.0.1.0\ view, successfully install to local
Step Three: Add dependency to the pom.xml of the required project
<!--load Oracel JDBC Driver package-- <dependency> <groupId>com.oracle</groupId> <artifactId>ojdbc14</artifactId> <version>10.2.0.1.0</version> </dependency> |
With these steps, you can use the Oracle driver.
Reprinted from: http://blog.csdn.net/qicyt1812/article/details/13019933
How to load an Oracle driver in a MAVEN project