I have imported a Maven Project in Eclipse (EE Developer) and I have in my pom.xml file the following error, “Missing artifact com.oracle:ojdbc7:jar:12.1.0.2″ in this code:
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc7</artifactId>
<version>12.1.0.2</version>
</dependency>
I have done so by downloading the ojdbc7.jar and run this command:
mvn install:install-file -Dfile=/Path-to-jar/ojdbc7.jar
-DgroupId=com.oracle
-DartifactId=ojdbc7
-Dversion=12.1.0.2
-Dpackaging=jar
-DgeneratePom=true
After that, I got as an output BUILD SUCCESS, and if I go to the .m2 folder I see in the com->oracle->ojdbc7 two files called “ojdbc7-12.1.0.1.jar.lastUpdated” and “ojdbc7-12.1.0.1.pom.lastUpdated” but still Eclipse brings me the code into the pom.xml file as an error?!?!?!
Can some one help?
This artifact version (12.1.0.2) has been removed to an another dependency.
See: https://mvnrepository.com/artifact/com.oracle/ojdbc7
Try to change the new dependency:
<dependency>
<groupId>com.oracle.database.jdbc</groupId>
<artifactId>ojdbc8</artifactId>
<version>12.2.0.1</version>
</dependency>
After successfully running the "mvn install" command right click your Project -> Maven -> Update Project (or Alt+F5).
I would get rid of those 2 files manually (lastUpdated) then re-run your install command and finally build your project. Those 2 files have been created by mvn as flags to avoid refetching them for a certain amount of time. They certainly have been created prior to your manual install-file command.
I recommend you to follow the instruction given in this link.
"http://javabycode.com/build-tools/maven/add-oracle-jdbc-driver-maven.html"
As per your dependency in pom.xml there should be 4 files generated inside "m2repo\com\oracle\ojdbc7\12.1.0.2" folder.
ojdbc7-12.1.0.2.jar
ojdbc7-12.1.0.2.jar.lastUpdated
ojdbc7-12.1.0.2.pom
ojdbc7-12.1.0.2.pom.lastUpdated
But as you are saying you checked for "ojdbc7-12.1.0.1.jar.lastUpdated", that should not be the case. I recommend you to delete your dependency folder and then start from scratch.
Some how the jar is not getting downloaded into the local pc. I opened the maven site https://mvnrepository.com/artifact/com.oracle/ojdbc7/12.1.0.2 and downloaded the required jar and placed it in to the .m2 folder, and the error is gone.
Related
I am trying to upgrade to Selenum 4.0.0-alpha-6 (same issue happens also with version 3.141.59) which seems to be available in Maven repository. I tried first to add this dependency to my pom.xml:
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>4.0.0-alpha-6</version>
</dependency>
The version appears red in IntelliJ which for some reason sees 3.12.0 as the last available version. I know what version IntelliJ sees because I can hit CTRL-space inside the <version> tag.
Running mvn install also complains that the version is not available. So my first question is why do Intellij and Maven not see the latest versions of Selenium?
I reverted to downloading the jar file directly from mvnrepository (that is from here) and adding it to my local repository as follows:
mvn install:install-file -Dfile=selenium-java-4.0.0-alpha-6.jar
-DgroupId=org.seleniumhq.selenium -DartifactId=selenium-java
-Dversion=4.0.0-alpha-6 -Dpackaging=jar -DgeneratePom=true
The jar appears now in my local repo, the Maven dependency does not appear red anymore, but all Selenium-related references in my project appear red. Examining the downloaded jar file reveals that it contains no Java classes:
C:\Development\Java\Selenium>jar tf selenium-java-4.0.0-alpha-6.jar
META-INF/
META-INF/MANIFEST.MF
META-INF/versions/9/
META-INF/versions/9/module-info.class
Any idea what I am missing?
Update: I have added a small project in GitHub that demonstrates the problem. The pom just has the Selenium dependency.
Just running mvn install results in the error below. So this is not just a problem with IntelliJ:
[ERROR] Failed to execute goal on project MySeleniumProject: Could not resolve dependencies for project com.my:MySeleniumProject:jar:1.0-SNAPSHOT: Failed to collect dependencies for [org.seleniumhq.selenium:selenium-java:jar:3.141.59 (compile)]: Failed to read artifact descriptor for org.seleniumhq.selenium:selenium-ja
va:jar:3.141.59: Could not transfer artifact org.seleniumhq.selenium:selenium-java:pom:3.141.59 from/to central (http://repo.maven.apache.org/maven2): Failed to
transfer file: http://repo.maven.apache.org/maven2/org/seleniumhq/selenium/selenium-java/3.141.59/selenium-java-3.141.59.pom. Return code is: 501 , ReasonPhras
e:HTTPS Required.
Try use stable older version
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>3.141.59</version>
</dependency>
Check also, if you have other errors in pom, and have proper java version
I think your project is correct and problem is with maven configuration. Use commandline to see what maven version you have? maven -v. Try use mvn dependency:resolve on the project - from command line
The problem is resolved by upgrading maven. I had Maven 3.0.5, and uprading to 3.6.3 resolved the dependency successfully.
I'm a relative Maven novice and am having difficulties using a locally stored jar as a module within my IntelliJ project - a project I have taken from an online tutorial.
I've brought it into my .m2 folder using:
mvn install:install-file "-Dfile=C:/../resources/myshop-automatedtestscore 3.1.17-SNAPSHOT.jar" "-DpomFile=C:/../resources/myshop-automatedtestscore-3.1.17-SNAPSHOT.pom --Dsources=C:/../myshop-automatedtestscore-3.1.17-SNAPSHOT-sources.jar"
.jar is located at:
C:\Users\daveb\.m2\repository\com\myshop\automatedtests\myshop-automatedtestscore\3.1.7-SNAPSHOT\3.1.17-SNAPSHOT.jar
And I added the dependency in the main pom.xml as follows:
<dependency>
<groupId>com.myshop.automatedtests</groupId>
<artifactId>myshop-automatedtestscore</artifactId>
<version>3.1.17-SNAPSHOT</version>
</dependency>
When I go to Project Structure -> Libraries, I can see the Sources dependency jar file is there in grey so should be fine. However the core project seems to be unable to access the class versions of the file. In Target folder they remain .class but in External libraries they are .java
Apologies if this is a novice or obvious solution. I'm trying to resolve.
You have to install jar using below command -
mvn install:install-file -Dfile= -DgroupId= -DartifactId= -Dversion= -Dpackaging=
You have to give artifacts and other parameters so that you will be able to use in pom file using below code -
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-jackson-provider</artifactId>
<version>1.1.GA</version>
</dependency>
After that you have to complie your project so that this dependency will be added in your project.
mvn eclipse:eclipse
mvn clean install
You can press here to force refresh the plugins in Intelij.
Here you can check which repository you have and also which maven you have.
Click on preferences
Another option you have is to perform this :
mvn clean install -U
If your dependency is
<groupId>com.me.example</groupId>
<artifactId>my-example</artifactId>
<version>1.1.0</version>
Then your jar file would be my-example-1.1.0.jar and it will be under \.m2\repository\com\me\example\my-example\1.1.0\my-example-1.1.0.jar.
In your case, your jar file is myshop-automatedtestscore-3.1.17-SNAPSHOT.jar and it should be under
C:\Users\daveb.m2\repository\com\myshop\automatedtests\myshop-automatedtestscore\3.1.17-SNAPSHOT\myshop-automatedtestscore-3.1.17-SNAPSHOT.jar.
After this, do a Maven > Reimport from IntelliJ.
Im getting the following error below
Ive added the following dependency and the code compiles...Im getting this even when commenting out the code where the error says its failing....
It woks when I deploy on Heroku but fails when running locally....
Any idea? Im lost....
My dependency:
<dependency>
<groupId>com.sendgrid</groupId>
<artifactId>sendgrid-java</artifactId>
<version>4.2.0</version>
</dependency>
Look the errors in Maven console. It seems dependency not getting downloaded to your classpath.
If its downloading, try cleaning and building again.
Also try maven update settings.
Most likely your local maven repository is broken. You may try below:
Go to your local Maven repository to check if the artifact is downloaded or not. It may be that the the artifact was not downloaded at all or not downloaded fully/correctly;
If you can find the sendgrid dir in your local maven repository, try delete the dir and execute mvn clean install (or mvn clean idea:idea), this should force maven to re-download the artifact.
I have a maven dependency which requires org\drools\drools-compiler 4.0.3 (drools-compiler 4.0.3 is not mentioned in my pom.xml but gets downloaded as a dependency). Now I am trying to integrate Drools framework with Spring. This requires me to use drools-spring 5.4.0.Final jar. Hence I have added the below pom entry.
<dependency>
<groupId>org.drools</groupId>
<artifactId>drools-spring</artifactId>
<version>5.4.0.Final</version>
</dependency>
<dependency>
<groupId>org.drools</groupId>
<artifactId>drools-compiler</artifactId>
<version>5.4.0.Final</version>
</dependency>
Now when I run a mvn clean install , I see the dependency drools-spring and corresponding dependencies (drools-compiler 5.4,drools core 5.4) getting downloaded, but however after doing mvn eclipse:eclipse, I still dont find the new dependencies showing up under maven dependencies in Eclipse classpath. In fact I still see the old 4.0.3 version under dependencies for drools-compiler and drools-core. I have tried an eclipse restart. Doesnt help either. How do I show the new 5.4 version jar instead of the 4.0.3 ?
As you mentioned you are using eclipse i will suggest to use maven eclipse plugin from eclipse market place.
When you will add maven plugin from eclipse you will able to see a Maven menu item when you will right click on the maven project then inside that menu you will able to see Update Maven project click on that.
If you do not want to do above two steps run the below command with -U.
Check below
mvn eclipse:eclipse -U
OR
mvn install -U
OR
mvn clean -U
See Maven: The Complete Reference, 6.1.11. Downloading and Verifying Dependencies or mvn --help:
-U,--update-snapshots Forces a check for missing
releases and updated snapshots on
remote repositories
Maven command with
I figured out I was adding the pom entries in the wrong pom.xml. Ideally the pom entries should be present in the service impl pom.xml.
I just needed to use a 3rd party JAR in my project and deployed the JAR in my local maven repo. I followed these steps while doing this:
->Runned the belowed statement:
mvn install:install-file -Dfile=c:\DEVEL\gsa-japi-src-1.3.jar -DgroupId=net.sf.gsaapi
-DartifactId=gsaapi -Dversion=1.3 -Dpackaging=jar
->I saw "BUILD SUCCESSFUL" message, checked local repo files and it seemed the deployment was succesfull.
->After installed and deployed, i just added following statements in pom.xml file.
<dependency>
<groupId>net.sf.gsaapi</groupId>
<artifactId>gsaapi</artifactId>
<version>1.3</version>
</dependency>
But I still can not reach the library's methods. Am I missing something?
gsa-japi-src-1.3.jar contains only source files (.java) and apidocs. You need a jar with .class files
Correct dependency is:
<dependency>
<groupId>net.sf.gsaapi</groupId>
<artifactId>gsa-japi-src</artifactId>
<version>1.3</version>
</dependency>
You have installed JAR use net.sf.gsaapi:gsaapi artifact identifier but in dependency you are using com.google.code:kaptcha. So, you should use the same artifact identifier in dependencies.