subhashis subhashis - 1 year ago 121
Java Question

Unable to add Maven Dependency in pom.xml for ojdbc14

I am trying to add dependency for ojdbc14 in pom.xml

OS: WindowsXP(sp3)
DB: Oracle 10G

I am using m2e plugin in eclipse.

Steps I followed for adding ojdbc14.jar in local repository of maven

  1. create a new project > maven project > org.codehaus.mojo.archetypes webapp-j2ee1.4

  2. move to that particular folder where is pom.xml file was located in command prompt.

  3. execute the command mvn clean.

  4. execute the command
    ' mvn install:install-file -Dfile="D:\oracle10g\jdbc\lib\ojdbc14.jar" -DartifactId=ojdbc14 -Dversion= -Dpackaging=jar '

after this I got a build success message

D:\Eclipse Workspace\BOOK_SHOP\BookShop>mvn install:install-file -Dfile="D:\oracle10g\jdbc\lib\ojdbc14.jar" -DartifactId=ojdbc14 -Dversion= -Dpackaging=jar

[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Building BookShop 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] --- maven-install-plugin:2.4:install-file (default-cli) @ BookShop ---
[INFO] Installing D:\oracle10g\jdbc\lib\ojdbc14.jar to D:\Maven Repository\Local Repository\com\oracle\ojdbc14\\ojdbc14-
[INFO] ------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.375s
[INFO] Finished at: Mon Oct 28 14:38:03 IST 2013
[INFO] Final Memory: 2M/15M
[INFO] ------------------------------------------------------------------------

I have updated the global and local repository in Eclipse > Maven Repositories

5 . I add dependency in pom.xml

enter image description here
enter image description here

But I got error in my pom.xml file, and I am able to see the ojdbc14.jar file in my local repository. Is there any thing wrong in the steps I followed. Please help me out.


Answer Source

Eclipse and your command line Maven use different repositories. The command line uses D:\Maven Repository\Local Repository\ while Eclipse uses %HOME%\.m2\repository

Find out why the two disagree (usually, the path in settings.xml is wrong or the two use different settings files).