Missing artifact com.oracle:ojdbc6:jar:11.2.0.3 - java

I am a beginner to Maven project. In my project, I am getting the error Missing artifact com.oracle:ojdbc6:jar:11.2.0.3, even though the jar was present in my repository at the correct folder. Can anyone help with this, please?

Unfortunately, due to the binary license, there is no public repository with the Oracle Driver JAR, so you cannot just add it to your pom file.
You have to add this jar manually:
First, you have to download ojdbc6.jar from here
click jar (2.6 MB) on the middle of the page.
Then put ojdbc6.jar in some folder in your project (let's use lib).
Then you have to add this in your dependencies section in your pom.xml:
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc</artifactId>
<version>11.2.0</version>
<scope>system</scope>
<systemPath>${basedir}/lib/ojdbc6.jar</systemPath>
</dependency>
Another option is to install this jar in your local maven repository:
mvn install:install-file -Dfile=path/to/ojdbc6.jar -DgroupId=com.oracle -DartifactId=ojdbc6 -Dversion=11.2.0 -Dpackaging=jar
And then you will be able to reference this dependency like this:
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc6</artifactId>
<version>11.2.0</version>
</dependency>
You have to choose what's best for you.

Remove the ojdbc6 folder from the .m2 repository completely and then maven update the project in enclipse that solved my problem

<repositories>
<repository>
<id>spring-releases</id>
<url>https://repo.spring.io/libs-release</url>
</repository>
</repositories>
Should solve the issue if you are using spring boot

Once you face the issue . Check in your maven user settings path . This will be a path something like :
C:\Users\ user name\ .m2\repository
Open the location and go to oracle\ojdbc6\11.2.0.3 folder and put the .jar on that location .Return back to eclipse perform maven update and your issue will be gone.

Related

Missing package for org.apache.http, JAR can't be found

I need the org.apache.http package, where i have tried to use the find JAR on web function built inside intelliJ, but no matter, what jar i try to get, it all returns 404 (is this because the package is depricated?)
how is the error i get when i try:
Is there any way to get this jar package?
Try downloading it from maven repositories
https://mvnrepository.com/artifact/org.apache.httpcomponents/httpcore/4.4.12
If it's a maven project, specify in your pom.xml the repository. And add the dependencies to apache.
<repositories>
<repository>
<id>my-repo</id>
<url>https://my repo.com</url>
</repository>
</repositories>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpcore</artifactId>
<version>4.4.12</version>
</dependency>

Import JAR files to spring using maven

I tried to import some JAR files to my maven spring project using maven install plugin.
I placed the JARs in a lib folder in my base directory (where the POM.XML file is) and installed them one by one manually by running mvn install.
My xml looks like:
EDIT:
<dependency>
<groupId>com.keydoxWeb</groupId>
<artifactId>keydox</artifactId>
<version>1.0</version>
<scope>system</scope>
<systemPath>myPath\codecs.jar</systemPath>
</dependency>
<!-- and so on.. -->
Still telling me this error:
"Should use a variable instead of a hard coded path"
To import jars to your local repo, you generally would not have to or want to edit a pom.xml file. Rather there are shell commands that you can use to import the jars to your local maven repo (typically located at ~/.m2). Said commands are described here -- looks like this:
mvn install:install-file -Dfile=<path-to-file> -DgroupId=<group-id> \
-DartifactId=<artifact-id> -Dversion=<version> -Dpackaging=<packaging>
Once you do this, you'll also have to bring the dependencies into your projects pom.xml as explicit dependencies. That will look like this:
<dependencies>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.6.0</version>
</dependency>
...
</dependencies>
Hope it helps!
Usually you do not have to import jars manually - they are installed by maven into local repository. And eclipse needs to know where this maven repository is. You may regenerate eclipse project files via
mvn eclipse:eclipse
(or switch to IntelliJ IDEA which opens maven projects natively)

Impossible to add my jar with scope in my project maven

Sorry for the spelling, I'm french
I try to install with scope a jar for oracle in my project
Here my pom.xml
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc7</artifactId>
<version>12.1.0.2</version>
<scope>system</scope>
<systemPath>C:/Users/bin/Desktop/dossier_access/instantclient_12_1/ojdbc7.jar</systemPath>
</dependency>
The maven compile didn't function
I did after (it works)
mvn -X install:install-file -Dfile=C:/Users/bin/Desktop/dossier_access/instantclient_12_1/ojdbc7.jar -DgroupId=com.oracle -DartifactId=ojdbc7 -Dversion=12.1.0.2 -Dpackaging=jar -DpomFile=C:/Users/Documents/Projets/version7/integration-archetype/batch/packaging/integration-archetype-batch/pom.xml
but mvn install gives :
[WARNING] The POM for oracle.jdbc:ojdbc7:jar:12.1.0.2 is missing, no dependency information available
[WARNING] The POM for oracle.jdbc:ucp:jar:12.1.0.2 is missing, no dependency information available
BUILD FAILURE
Thank you for your responses,
i'm beginner with Maven and I have already see on the other posts...
What i usually do is first install jdbc driver in local repository so it is available for all apps in local machine.
Then just use regular dependency tag to include it in you pom file.
Look at this quick tutorial:
http://www.mkyong.com/maven/how-to-add-oracle-jdbc-driver-in-your-maven-local-repository/
After installing a 3rd party into your local repo (that is what you did with mvn install:install-file) you can reference it the following way:
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc7</artifactId>
<version>12.1.0.2</version>
</dependency>
And no path information is required anymore.

how to download dse.jar

I am trying to use DataStax Enterprise 4.6 to write a Spark application in Java and run
it in DSE's Spark analytics mode.
The code for creating a Spark context using DSEConfHelper:
SparkConf conf = DseSparkConfHelper.enrichSparkConf(new SparkConf())
.setAppName( "My application");
To use DSEConfHelper we need to import com.datastax.bdp.spark.DseSparkConfHelper
which is located in dse.jar.
In my pom.xml I have included the dependency:
<dependency>
<groupId>com.datastax</groupId>
<artifactId>bdp</artifactId>
<version>4.6.0</version>
</dependency>
But Maven cannot download dse.jar.
Please help me.
The reference for code for creating a Spark context is taken from:
http://www.datastax.com/documentation/datastax_enterprise/4.6/datastax_enterprise/spark/sparkJavaApi.html
Edit: This has been entirely superceded by the com.datastax.dse.dse-spark-dependencies artifact. Add it to your pom.xml:
<dependencies>
<dependency>
<groupId>com.datastax.dse</groupId>
<artifactId>dse-spark-dependencies</artifactId>
<version>${dse.version}</version>
<scope>provided</scope>
</dependency>
<dependencies>
<repositories>
<repository>
<id>DataStax-Repo</id>
<url>https://repo.datastax.com/public-repos/</url>
</repository>
</repositories>
See https://github.com/datastax/SparkBuildExamples for Maven, SBT, and Gradle example projects.
Original, outdated answer:
You have to manually install dse.jar as of right now. There are two ways of doing this.
Option 1
Install the JAR file using mvn install:
$ mvn install:install-file -Dfile=<path-to-dse.jar> -DgroupId=com.datastax -DartficactId=bdp -Dversion=4.6.0
Option 2
Manually copy dse.jar from your install location to ${project.basedir}/lib/. Then modify your pom.xml:
<dependency>
<groupId>com.datastax</groupId>
<artifactId>bdp</artifactId>
<version>4.6.0</version>
<scope>system</scope>
<systemPath>${project.basedir}/lib/dse.jar</systemPath>
</dependency>
I don't really know why you're calling the artifact "bdp", but for these purposes it doesn't matter, and I just used it as well.
dse.jar is part of DSE installation. If you are working in windows environment, you can find it here dse.jar
register,download and extact to find the jar in lib folder. The use the above answer to add it in your maven project.

JAHMM Package Maven

I need to work with be.ac.ulg.montefiore.run.jahmm package for Hidden Markov Models in java.
My project is a mevenized project so I need to use the corresponding dependency.
<dependency>
<groupId>be.ac.ulg.montefiore.run.jahmm</groupId>
<artifactId>jahmm</artifactId>
<version>0.6.2</version>
</dependency>
The above dependency is not being resolved in my project.
Does anyone know how to help me?
Thank you.
Your dependency is not in the Maven Central Repository.
Find out the repository used by the authors to publish their artifacts and add this repository to your POM or to your settings.xml.
If it is not published to the usual online maven repositories, you will need to install it on your local machine first.
So download the sources, go to the top level and do the usual
mvn install
Once you installed jahmm locally, your project can resolve it from your maven cache.
Adding this repository should do the trick:
<repositories>
<repository>
<id>jsi</id>
<url>http://repo.springsource.org/libs-release-remote</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>be.ac.ulg.montefiore.run.jahmm</groupId>
<artifactId>jahmm</artifactId>
<version>0.6.2</version>
</dependency>
...
</dependencies>

Categories