Question

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>
Was it helpful?

Solution

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.

OTHER TIPS

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>

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

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top