0

I've been trying to make a runnable jar from my project (in Intellij IDEA) which has a dependency to an oracle (driver -> ojdbc6) jar. When I package the project with all of the dependencies, the only one what will be excluded is the jar. Which means my db queries are going to fail when I run it. I've found several similar questions*, but I've failed the execution of them, because I don't know the groupid and artifact id of the oracle's jar.

*like this one: build maven project with propriatery libraries included

p.s.: the jar wad added through the IDEA's feature (project structure -> modules), and with this solution the project could run without failure. The problem starts with the packaging.

Community
  • 1
  • 1
Gregito
  • 117
  • 1
  • 2
  • 9

1 Answers1

0

Short Solution: Try using the below:

<dependency>
  <groupId>LIB_NAME</groupId>
  <artifactId>LIB_NAME</artifactId>
  <version>1.0.0</version>
  <scope>system</scope>
  <systemPath>${basedir}/WebContent/WEB-INF/lib/YOUR_LIB.jar</systemPath>  // give the path where your jar is present
</dependency>

Make sure that the groupId, artifactID and the version number are unique.

Long Solution:

  1. Download the jar file to your machine.
  2. Navigate using the prompt to the folder where you downloaded the jar.
  3. Run the following command to install the jar to your local repository.

mvn install:install-file -DgroupId=com.oracle -DartifactId=ojdbc6 -Dversion=11.2.0.3 -Dpackaging=jar -Dfile=ojdbc6.jar -DgeneratePom=true

  1. Finally, add the dependency to the pom.xml.

    <dependency> <groupId>com.oracle</groupId> <artifactId>ojdbc6</artifactId> <version>11.2.0.3</version> </dependency>

Also, don't forget to use -U option while running the project.

RITZ XAVI
  • 3,633
  • 1
  • 25
  • 35