Proper way to add ojdbc8.jar to Eclipse/maven project - oracle

Just joined a company (and an existing project) and first blocker is getting Eclipse/maven/pom.xml to recognize I do actually have the ojdbc8.jar file on my system. Eclipse/maven/pom.xml disagree. When looking at the pom.xml file, Eclipse says "Missing artifact com.oracle.jdbc:ojdbc8:jar:12.2.0.1"
I have tried adding the jar to the "Referenced Libraries". No joy.
I have tried installing maven and then the jar into the maven repo (see this link) which ran fine, but Eclipse/maven still say the artifact is missing.
I guess because Eclipse uses it's own maven repo, but I don't know how to add a jar file to it, or if that is even the right way to do this. ** After reading some more, it appears I have been misled and Eclipse does not have it's own maven repo?**
I also found this at Oracle's website, but it seems like a lot of steps and I already added the jar to my local repo so I don't expect it to help.
I have tried asking my co-worker. No response...
Anyone know how to do this?

So I found this page
which is completely different from anything else I have read (so far). You add the Oracle jdbc file to your Eclipse preferences. Nothing to do with your project. My pom.xml file is not longer red.
<dependency>
<groupId>com.oracle.jdbc</groupId>
<artifactId>ojdbc8</artifactId>
<version>12.2.0.1</version>
</dependency>

Related

How to fix The POM for XXX:jar:1.0 is missing, no dependency information available

We tried to build our project(Spring Boot 2.0.3 with Maven 3.3.9 dependency management)Jenkins Tool(Linux environment).Its saying build failure showing the following message in console "The POM for org.actus:ACTUS-Core-1.0:jar:1.0 is missing, no dependency information available".ACTUS is our custom java library developed by us and its in the local repository also.
This is the first time we started using Jenkins Tool. There are some other modules which depends on this same ACTUS jar.Those are also failing.I have searched for solution on internet.Some people said,make changes to settings.xml file.But in our development machine ,we cant find any such type of settings.xml file(in .m2)
remaining all dependencies are normal spring boot dependencies only.This is the only one external or custom jar.Using mvn install, we kept in maven local repo.
<dependency>
<groupId>org.actus</groupId>
<artifactId>ACTUS-Core-1.0</artifactId>
<version>1.0</version>
</dependency>
I will try to explain as much I can to solve your problem. I hope you are looking for settings.xml to update your maven Nexus repository. If you don't know about nexus repository, it's kind of public repo where you will get all open source dependency.
In your case, from your organization, you should have a private nexus repository and upload ACTUS-Core jar to there.
Then update your settings.xml file to use your company nexus repository. (Please check comments, it will be available in M2_HOME location)
So while you execute mvn install automatically it will upload in your private repository.
Now, in your pom.xml mention the same nexus repository. (It's optional)
Then, in your Jenkins script, you have updated this nexus repo.
So, the key point is you should have your own repo to upload ACTUS-Core jar and need to access the same while you building in Jenkin tool.
OR ELSE
If you find all the above activities in pain / not possible then I can suggest a short cut solution.
Create a lib folder under your project name ( same hierarchy as src) then add your ACTUS-Core.jar and commit that file along with your source code.
Then, update your pom file like below. It will work.
<dependency>
<groupId>com.test</groupId>
<artifactId>test</artifactId>
<version>11.1</version>
<scope>system</scope>
<systemPath>${project.basedir}/lib/fileName.jar</systemPath>
</dependency>

selenium-central-framework in pom.xml

I am not able to find any hint about the issue that I am facing and hence posting my question here. Please apologize if it is something silly.
I have some working experience in selenium webdriver. However in my new project, I was asked to use an existing Selenium framework.
In the pom.xml, I am seeing the below dependency (I have edited xxx to avoid displaying the company name)
<dependencies>
<dependency>
<groupId>com.xxxqa.selenium</groupId>
<artifactId>selenium-central-framework</artifactId>
<version>2.0.18</version>
</dependency>
Question :
I couldn't understand from where that dependancy was taken from ?
Solution Tried :
I have tried searching in the maven repository still couldn't find
anything related to "selenium-central-framework"
I have checked the dependencies of selenium RC, but they seems to be different from the one that is present above.
I have researched whether any local jars were used and were linked
as dependancy. However I understand from maven repository, local
repositories will be linked with the tag "systemPath"
<dependency>
<groupId>ldapjdk</groupId>
<artifactId>ldapjdk</artifactId>
<scope>system</scope>
<version>1.0</version>
<systemPath>${basedir}\src\lib\ldapjdk.jar</systemPath>
</dependency>
</dependencies>
Note that the depedency used in my project doesn't have the tag "systemPath".
Is there anyway the external repositories could be added without mentioning systemPath ??
Please help, what could be that dependency ? How to find more information about it. Thanks a ton for your help.
I suggest you one of these approaches:
Jar file
If you have access to the jar file called : selenium-central-framework-2.0.18.jar, open a command line pointing to the folder of this jar and execute:
mvn install:install-file \
-Dfile=selenium-central-framework-2.0.18.jar \
-DgroupId=com.xxxqa.selenium \
-DartifactId=selenium-central-framework \
-Dversion=2.0.18 -Dpackaging=jar
Source code file
If you have the source code of : selenium-central-framework-2.0.18.jar, open a command line pointing to the folder of this source code and execute:
mvn clean install
After one of these approaches, selenium-central-framework-2.0.18.jar will be available in you local maven repository ($HOME/.m2) and your other java maven projects will be ready to use it as dependency:
<dependency>
<groupId>com.xxxqa.selenium</groupId>
<artifactId>selenium-central-framework</artifactId>
<version>2.0.18</version>
</dependency>
This is a workaround if you don't have a server to host an artifact repository management server like :
https://www.sonatype.com/nexus-repository-sonatype
https://www.jfrog.com/confluence/display/RTF/Maven+Repository
Explanation
Almost all free, public, safe, useful and cool java libraries are hosted in https://mvnrepository.com . So any person in the world can use it in their maven project with this piece in their pom.xml:
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>3.141.59</version>
</dependency>
But in some cases, publish your source code to https://mvnrepository.com is not an option:
Oracle Driver. This driver (.jar) can only be downloaded from the official Oracle page. Private source code like IBM, Microsfot,etc
Source code of your company that should not be public.
Some super cool library that is only in github but not in the maven central repository.
So in this cases, the best and scalable solution is host and configure some artifact repository management server like :
https://www.sonatype.com/nexus-repository-sonatype
https://www.jfrog.com/confluence/display/RTF/Maven+Repository
This platforms are an emulation of https://mvnrepository.com . So with a minimal configuration:
You can host your special or private jars
Your maven projects could use this jars with the standrad xml dependency in pom.xml.
If you don't have a server to implement one of these platforms, the previous approaches could help you and get the same results

Unresolved plugin: 'org.apache.maven.plugins:maven-jar-plugin:2.4'

After I use IntelliJ IDEA to create a maven module, there is some problem in the Maven Projects view. And when my cursor hover on the maven project, i see this:
Project:
cn.itcast.babasport:parent:1.0-SNAPSHOT
Location:
/home/shuaidi/IdeaProjects/parent/pom.xml
Problems:
Unresolved plugin: 'org.apache.maven.plugins:maven-jar-plugin:2.4'
Unresolved plugin: 'org.apache.maven.plugins:maven-compiler-plugin:3.1'
Unresolved plugin: 'org.apache.maven.plugins:maven-surefire-plugin:2.12.4'
Unresolved plugin: 'org.apache.maven.plugins:maven-install-plugin:2.4'
Unresolved plugin: 'org.apache.maven.plugins:maven-site-plugin:3.3'
This is my first time using IntelliJ IDEA, so I do these thing with a new installed IDEA and a new installed maven, and i just create a maven module and didn't do any other thing. I don't know why these problem appearance.
I just want to create a maven module without any problem.
ps:
this is all my pom file.
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>cn.itcast.babasport</groupId>
<artifactId>parent</artifactId>
<version>1.0-SNAPSHOT</version>
</project>
This is a duplicate of Maven plugins can not be found in IntelliJ. The top answers there did not work for me, so I'll describe what I did.
I just put the needed plugins into my ~/.m2/repository. There are two ways that achieve that. Either download the files manually with mvn dependency:get, or (my preferred way) make the plugins a dependency in some (whichever) pom.xml and build that project.
<dependency>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-install-plugin</artifactId>
<version>2.4</version>
<type>maven-plugin</type>
</dependency>
<dependency>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.7</version>
<type>maven-plugin</type>
</dependency>
Now you can remove the dependencies. Then click "Reimport all Maven Projects" in Intellij (the blue circular arrows icon).
This issue seems completely harmless, but the squiggly lines are kind of infuriating, so I am glad I was able to get rid of them.
Instead of trying to install the plugin into your repository, actually delete it from your repository. It might have a corrupt or unsupported version that IJ cannot parse.
see https://stackoverflow.com/a/44883900/5093961
Change Maven home directory in Maven setting, and select supported Maven bundle version (Maven 2 or Maven 3), then apply setting. It's worked for me.
In my case same situation occurred because of different version exist in same system.
System have version 2.** and my project expect 3.** something
in such case, i use maven wrapper instead of maven to build project.
mvn clean install
instead of,
mvnw clean install
If you want this error to be gone without having to worry about all those xml files and copy pasting stuff just try the below solution
Note: This is manual way
In your InteliJ IDEA, go to search and type "Project Structure"
Search>Project Structure
or press:
Ctrl + Alt + Shift + S
Now go to Libraries under project settings
Project Settings>Libraries
Now look for red lined dependencies and click it
For example:
Click "Maven: javax:javaee-web-api:7.0"
Now look whether all three files are red lined
Example: Classes, Sources, JavaDocs
If any of the path under these names are redlined then go to that path and keep the folder open
For example: The path would look like this
Classes
C:\Users\shifny.m2\repository\javax\javaee-web-api\7.0\javaee-web-api-7.0.jar
Sources
C:\Users\shifny.m2\repository\javax\javaee-web-api\7.0\javaee-web-api-7.0-sources.jar
JavaDocs
C:\Users\shifny.m2\repository\javax\javaee-web-api\7.0\javaee-web-api-7.0-javadoc.jar
Now go to the folder as said above and keep it open
In my case its
C:\Users\shifny.m2\repository\javax\javaee-web-api\7.0
Now click this website
and search for the jar file
In my case it's:
javaee web api
Now click the link and select the version in next page
In my case it's:
7.0
Now find the "Files" row which will be between "Date" and "Repositories"
In the Files row, click View All
It will open a page like This
In that page download the missing files(classes,source,javadoc)
It will look like this
javaee-web-api-7.0.jar
javaee-web-api-7.0-sources.jar
javaee-web-api-7.0-javadoc.jar
Download all three and put it into the folder which I said you to keep open
Now open your project in inteliJ IDEA and build your project and open the "project structure" as instructed above and check it, the redlined files will have no redlines anymore.
This may seem easy but if there are more files which generates errors then you will have to do this process multiple times and download the missing files.
In that case the above solutions may help...
Check idea.log for errors related to Maven importing, it could be
a network issue with localhost
invalid VM options for Maven VM (too large heap or a typo in VM options)
Maven process failing for some other reason (like the recent Nvidia driver update has caused Java crashes).
I just solved this problem few minutes ago and this is what I figured and my solution:
The reason intellij is popping up with those errors is because the plugin files for those failed plugins in the ".m2" directory are not properly downloaded or they are broken.
This is what I did:
I went to "C:\Users\IYANU.m2\repository\org\apache\maven\plugins" folder. You will see that the name of the plugins matches the ones giving errors in IntelliJ
One after the other, in each plugin folder, I checked for the version giving error in IntelliJ then delete the version folder. Like for "maven-jar-plugin", the version in 2.4, delete the 2.4 folder in the maven-jar-plugin folder.
After deleting, go back to IntelliJ and reload your maven project. Make sure there is an internet connection. This will make IntelliJ properly download the plugin and the error won't pop up for that particular plugin again.
Repeat it for the other plugins giving error
Thank me later
This worked for me:
Download 'maven-jar-plugin:2.4.jar' from maven-repository (https://mvnrepository.com/artifact/org.apache.maven.plugins/maven-jar-plugin/2.4)
Paste the downloaded 'maven-jar-plugin:2.4.jar' in the local PC's mvn-repository ('C:\Users\[user-name].m2\repository\org\apache\maven\plugins\maven-jar-plugin\2.4' folder)
Wait for IntelliJ to pick up the change
All done!

How to include jar in Maven Netbeans proj that doesnt exist in maven repo

I am using Netbeans to build a Maven project, and have the JTidy java library as a dependency. It turns out JTidy doesnt exist in any maven repos, so I can't just add a "normal" depedency entry for it.
What is the best way of handling dependencies to libraries in Maven projects that arent available on repos?
I've currently tried adding it to my maven pom as such (after copying the jar to my projects /libs folder)
<dependency>
<groupId>org.w3c</groupId>
<artifactId>org.w3c.tidy</artifactId>
<version>9.3.8</version>
<scope>system</scope>
<systemPath>${basedir}/libs/jtidy-r938.jar</systemPath>
</dependency>
However it complains that it will be unresolvable by dependent projects.
First of all, it's under another groupId, that's why you didn't find it.
<dependency>
<groupId>net.sf.jtidy</groupId>
<artifactId>jtidy</artifactId>
<version>r938</version>
</dependency>
Jtidy
But to answer your question, one way of doing this is to manually install it in your local repo as described here.
The best way IMHO is to add it to a proxy like Nexus. That way other people can access it from there without having to install it locally. However, this means you have to set up a repository manager, which doesn't make much sense if you are the only developer on the project.

SBT - bad revision found

I get an error:
expected='2.0.0-SNAPSHOT found='${jpacontainer.version}'
Vaadin snapshot repository: bad revision found in
http://oss.sonatype.org/content/repositories/vaadin-snapshots/com/vaadin/addon/jpacontainer-addon-agpl-3.0/2.0.0-SNAPSHOT/jpacontainer-addon-agpl-3.0-2.0.0-20120117.082939-16.pom:
expected='2.0.0-SNAPSHOT found='${jpacontainer.version}'
while resolving dependency
val vaadinJPA = "com.vaadin.addon" % "jpacontainer-addon-agpl-3.0" % "2.0.0-SNAPSHOT"
Do you know how to fix this?
This is the POM: https://oss.sonatype.org/content/repositories/vaadin-snapshots/com/vaadin/addon/jpacontainer-addon-agpl-3.0/2.0.0-SNAPSHOT/jpacontainer-addon-agpl-3.0-2.0.0-20120117.082939-16.pom
The POM file is invalid. The POM is a module's meta data file and should list the correct version. This is what is causing your problems.
Snapshots have a tendency to be unstable (not always a good idea to use them).
Options?
Use a different snapshot module version.
If you really need this particular jar then I'd advise downloading it directly as follows:
https://oss.sonatype.org/content/repositories/vaadin-snapshots/com/vaadin/addon/jpacontainer-addon-agpl-3.0/2.0.0-SNAPSHOT/jpacontainer-addon-agpl-3.0-2.0.0-20120117.082939-16.jar
Update
That module is plain broken :-(
The jar can be found when browsing the file storage as follows:
https://oss.sonatype.org/index.html#view-repositories;vaadin-snapshots~browsestorage~/com/vaadin/addon/jpacontainer-addon-agpl-3.0/2.0.0-SNAPSHOT/jpacontainer-addon-agpl-3.0-2.0.0-20120117.082939-16.jar
This explains why the following dependency declaration in Maven might work:
<dependency>
<groupId>com.vaadin.addon</groupId>
<artifactId>jpacontainer-addon-agpl-3.0</artifactId>
<version>2.0.0-SNAPSHOT</version>
</dependency>
Without a proper POM the Nexus index will not be updated properly
https://oss.sonatype.org/index.html#nexus-search;gav~~jpacontainer-addon-agpl-3.0~2.0.0-SNAPSHOT~~
As you can see the jar is missing... So jar is present, repository index is unreliable

Resources