0

I am referencing a repository in my POM.xml to add the ojdbc.jar to my project but Maven (I use the STS plugin) keeps telling me it can't find the jar.
I am showing below my repositories and jar dependency as defined in my POM.xml.

Anyone has an idea as to why the jar can't be found? Is my POM.xml not setup properly?

Note the vaadin repo works fine as the vaadin jars are correctly added to my project.

  <repositories>

    <repository>
    <id>myrepo</id>
    <url>http://mvnrepository.com/</url>
    </repository>

    <repository>
    <id>vaadin-addons</id>
    <url>http://maven.vaadin.com/vaadin-addons</url>
    </repository>
  </repositories>

and here is the dependency setup as defined at http://mvnrepository.com/artifact/ojdbc/ojdbc/14:

<dependencies>
<dependency>
  <groupId>ojdbc</groupId>
  <artifactId>ojdbc</artifactId>
  <version>14</version>
</dependency>
</dependencies>
JasonMArcher
  • 14,195
  • 22
  • 56
  • 52
jule64
  • 487
  • 1
  • 6
  • 19
  • You don't need to setup `http://mvnrepository.com` cause [Maven Central contains](http://search.maven.org/#artifactdetails|ojdbc|ojdbc|14|jar) the artifact. – khmarbaise Mar 22 '14 at 18:45
  • same problem when I remove the repo.. – jule64 Mar 22 '14 at 22:02
  • Have you tried to build the project on command line outside the IDE? Just try it via `mvn clean package` and see if the artifacts are being downloaded or not? – khmarbaise Mar 22 '14 at 23:29

3 Answers3

1

To use Oracle jdbc(OJDBC) driver with Maven, you can download the jar to your local machine and install it manually into your Maven local repository.

After downloading the jar install using the following command :

mvn install:install-file -Dfile={Path_to_your_ojdbc.jar} -DgroupId=com.oracle 
-DartifactId=ojdbc -Dversion=14 -Dpackaging=jar . If the version is less than 14 change the appropriate version number  in -Dversion attribute

Now you can set the dependency details in the pom file :

<dependencies>
  <dependency>
    <groupId>com.oracle</groupId>
    <artifactId>ojdbc</artifactId>
    <version>14</version>
  </dependency>
</dependencies>
user1570577
  • 134
  • 1
  • 6
  • ok welcome. actually i have not given the answer for your question , why the jar can't be found? but i have told an alternate way to overcome this problem. The jar not found problem i think because ,Due to Oracle license restriction, there is NO public Maven repository provides Oracle JDBC driver. – user1570577 Mar 23 '14 at 18:52
  • @user1570577 I've referenced your contribute as asked by jule64. – taringamberini Mar 23 '14 at 19:01
1

Anyone has an idea as to why the jar can't be found?

The jar can't be found due to license constraints.

Is my POM.xml not setup properly?

No it isn't, but adding to your pom the dependency:

<dependency>
    <groupId>ojdbc</groupId>
    <artifactId>ojdbc</artifactId>
    <version>14</version>
</dependency>

you are able to download only the ojdbc14 pom because it has not a license limitation about distribution.

In order to make the above dependency works the jar has to be manually installed into your local Maven repository, without violating the license, by running:

mvn install:install-file -Dfile={Path_to_your_ojdbc.jar} -DgroupId=ojdbc 
-DartifactId=ojdbc -Dversion=14 -Dpackaging=jar

eventually changing to the appropriate version number in -Dversion attribute, as correctly suggested by user1570577.

Community
  • 1
  • 1
taringamberini
  • 2,719
  • 21
  • 29
  • Thanks but I am not able to download ojdbc14 by adding the dependency to my pom.xml as per your suggestion – jule64 Mar 23 '14 at 17:46
  • @jule64 I gave you no suggestion to download jar, because user1570577 has answered yet. I have said that if you add the dependency to your pom you should find in your ```.m2``` only the ```ojdbc/14/pom.xml``` because it has not a license limitation about distribution. – taringamberini Mar 23 '14 at 17:54
  • In this case would you mind adding a reference to user1570577's suggestion to complete your answer so I can accept it as most helpful? – jule64 Mar 23 '14 at 18:38
  • @user1570577 I've referenced your contribute as asked by jule64. – taringamberini Mar 23 '14 at 18:47
  • @jule64 user1570577's contribute referenced. – taringamberini Mar 23 '14 at 18:52
0

Oracle now has a maven repository: maven.oracle.com

See https://blogs.oracle.com/WebLogicServer/entry/weblogic_server_and_the_oracle

Sebastien
  • 5,506
  • 4
  • 27
  • 37