Maven Build Not Finding Oracle - oracle

I'm switching a maven project's db from MySQL to Oracle. I have this dependency in my pom.xml:
<!-- https://mvnrepository.com/artifact/com.oracle/ojdbc14 -->
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc14</artifactId>
<version>10.2.0.4.0</version>
</dependency>
But IntelliJ's maven view shows red squigglies on that dependency and mvn clean install gives me:
Could not resolve dependencies for project com.example:polls:jar:0.0.1-SNAPSHOT: Failure to find com.oracle:ojdbc6:jar:11.2.0.1.0 in https://repo.maven.apache.org/maven2 was cached in the local repository,
resolution will not be reattempted until the update interval of central has elapsed or updates are forced -> [Help 1]
So per this advice, I did a force (mvn clean install -U). But that gives me:
Downloading from central: https://repo.maven.apache.org/maven2/com/oracle/ojdbc6/11.2.0.1.0/ojdbc6-11.2.0.1.0.pom
[WARNING] The POM for com.oracle:ojdbc6:jar:11.2.0.1.0 is missing, no dependency information available
Downloading from central: https://repo.maven.apache.org/maven2/com/oracle/ojdbc6/11.2.0.1.0/ojdbc6-11.2.0.1.0.jar
... even though my .m2 does contain that dependency:
So why does my project not build? Is there some reason Oracle jars are not accessible via maven central?

It turns out Oracle JDBC drivers need to be obtained from the "Oracle Maven Repository". There's lots of guidance on that, which I guess I missed at first. They can also be downloaded directly.

Related

Plugin .url=jdbc:oracle:thin or one of its dependencies could not be resolved - Spring Boot liquibase

I'm currently working in my company developing an API in Spring Boot with an Oracle database, the problem is that we use liquibase to create the database, and when I try to use the command:
mvn liquibase:update -Dliquibase.url="jdbc:oracle:thin:#..." -Dliquibase.username="xxx" -Dliquibase.password="xxx" -Dinterface-user="xxx" -Dtablespace-tablas="xxx" -Dtablespace-indices="xxx" -Dstorage-tablas="xxx" -Dstorage-indices="xxx"
It returns me this error:
Plugin .url=jdbc:oracle:thin or one of its dependencies could not be resolved: Failure to find .url=jdbc:oracle:jar:thin in https://maven.oracle
.com was cached in the local repository, resolution will not be reattempted until the update interval of maven.oracle.com has elapsed or updates are for
ced -> [Help 1]
I think it is related with the dependency ojdbc8 from oracle but I can't figure out how to make it work.
I know that all the credentials for the database and everything are correct as I can totally use them to connect to the database with a db manager.
Here is my dependency in pom.xml:
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc8</artifactId>
<version>19.3</version>
</dependency>
Right now I've tried these things:
Downloading the dependency from maven repo (https://mvnrepository.com/artifact/com.oracle.ojdbc/ojdbc8/19.3.0.0) and installing it locally using the command: mvn install:install-file -Dfile=./ojdbc8.jar -DgroupId=com.oracle -DartifactId=ojdbc8 -Dversion=19.3 -Dpackaging=jar.
This supposedly installed the dependency locally, but still does not work.
Adding the oracle server to the dependency repos in maven config, following this oracle guide
(https://docs.oracle.com/middleware/1213/core/MAVEN/config_maven_repo.htm#MAVEN9016)
With this second change I manage to get a different error:
Plugin .url=jdbc:oracle:thin or one of its dependencies could not be resolved: Could not find artifact .url=jdbc:oracle:jar:thin in maven.oracle
.com (https://maven.oracle.com) -> [Help 1]
Could you help me find what am I doing wrong or something that I might be missing? Thanks!
You need to use the follow GAV for downloading the JDBC driver from central maven. Refer to Maven guide for more details
<dependency>
<groupId>com.oracle.database.jdbc</groupId>
<artifactId>ojdbc8</artifactId>
<version>19.3.0.0</version>
</dependency>
In the end, the main problem was that I was using the embedded console of IntelliJ and It wasn't working that way, I switched to cmd and it worked...

Issue in Jenkins build not Eclipse

In jenkins there are two project A and B both are maven project and both the projects are running fine when do clean and install from the STS.
However,when the same project is refered in jenkins as a maven project.Its not able to resolve the dependency of Project A.
When I put explicitly the Dependency in jenkins .m2 folder repository it works
Projects A jar is created here.
4.0.0
<groupId>com.XYZ.k</groupId>
<artifactId>abc</artifactId>
<version>1.0.0-SNAPSHOT</version>
<name>abc</name>
Referring in Project B POM like below.
<dependency>
<groupId>com.XYZ.k</groupId>
<artifactId>abc</artifactId>
<version>1.0.0-SNAPSHOT</version>
</dependency>
Problem is coming like not able to resolve dependency:
enter code here
[ERROR] Failed to execute goal on project rpg4xref: Could not resolve dependencies for project com.xyz.xa:B:jar:13.2.00-SNAPSHOT: Failure to find com.xyz.abc:abc:jar:1.0.0-SNAPSHOT in file:/// was cached in the local repository, resolution will not be reattempted until the update interval of localRepsoitory has elapsed or updates are forced -> [Help 1]

Spring STS spring boot project maven pom error

Hello I am trying to learn spring boot. I have installed Spring STS
Spring Tool Suite
Version: 3.6.4.RELEASE
Build Id: 201503100339
Platform: Eclipse Luna SR1 (4.4.2)
Java 1.7.
I am trying to create a spring starter project. After I do it with the sts I get the project generated but the Maven pom contains errors.
It always says : Project build error:
Project build error: Non-resolvable import POM: Failure to transfer org.springframework:spring-framework-bom:pom:4.1.6.RELEASE from repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced. Original error: Could not transfer artifact org.springframework:spring-framework-bom:pom:4.1.6.RELEASE from/to central repo.maven.apache.org/maven2): The operation was cancelled.
Failure to transfer org.springframework:spring-framework-bom:pom:4.1.6.RELEASE from //repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced. Original error: Could not transfer artifact org.springframework:spring-framework-bom:pom:4.1.6.RELEASE from/to central repo.maven.apache.org/maven2): The operation was cancelled.
Project build error: Non-resolvable import POM: Failure to transfer org.springframework.security:spring-security-bom:pom:3.2.7.RELEASE from repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced. Original error: Could not transfer artifact org.springframework.security:spring-security-bom:pom:3.2.7.RELEASE from/to central ( repo.maven.apache.org/maven2): The operation was cancelled.
The POM is automatically generated when I create a spring starter project and it always generates that error.
I understand that there is something wrong the the spring files but I don't know how to solve that problem.
Can someone here give me please an advice how to solve this.
Thanks.
Best regeards.
Khelvan
I was getting the same issue while importing maven project from spring initialzr.
Spring Tool Suite 4 Version: 4.1.0.RELEASE
Just add below lines in pom.xml file:-
<properties>
<maven-jar-plugin.version>3.1.1</maven-jar-plugin.version>
</properties>
Happy Coding ;
I had the same problem, using NetBeans 8.1, Maven 3.0.1, and Spring MVC versions 4.0.1 and 4.2.5.
The first solution I found on the web was to update Maven to version 3.3.9, which did not solve my problem. However, with more search I found a useful link. There it explains for including Maven's "bill of materials" (BOM) dependency you can use:
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-framework-bom</artifactId>
<version>4.2.5.RELEASE</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
Before I was missing <type> and <scope> tags in the auto-generated code. After adding them the problem was solved.
Since I am not sure if updating Maven also helped or not, you might also try that.
Check the version of the bom you are using. When I changed mine to 4.3.5.RELEASE, the error went away

Installed Jar is not picked up in compilation

I successfully installed a local jar to my repo using this command
mvn install:install-file -Dfile=myjar.jar -DgroupId=com.mygroup -DartifactId=art -Dversion=1.3 -DlocalRepositoryPath=/home/me/.m2/repository -Dpackaging=jar
This then created the jar file and pom in my repo correctly, so I can find it under com/mygroup/artifact/1.3/
but when I try to reference it in my project pom using (exactly what is defined in the installed pom)
<dependency>
<groupId>com.mygroup</groupId>
<artifactId>artifact</artifactId>
<version>1.3</version>
</dependency>
I get errors when trying to compile. It fails to find the installed jar.
Failed to execute goal on project myproject: Could not resolve dependencies for project com.myproject:war:1.0: Failure to find com.mygroup:artifact:jar:1.3 in http://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced -> [Help 1]
Im struggling to understand why it is failing to pick up my installed jar. What am I doing wrong?
In your mvn install:install-file you are publishing an artifactID of "art", and later you talk about it being "artifact". I assume this is just a typo in the obfuscation you made after running into the error.
It's hard to see what's going on without more details. I would suggest you blow away your local repo, redeploy the local file, and try again. Also, don't specify a localRepositoryPath (the default is what you want and this is one more potential source of error). Make sure you do this as the same user, preferably from the same shell to be sure.
I used the below ...
mvn install:install-file -Dfile=C:\Autus1\Autus1_Practice\bundle\target\Autus1_Service-1.0-SNAPSHOT.jar -DgroupId=com.autus1.cq5 -DartifactId=Autus1_Service -Dversion=1.3 -DlocalRepositoryPath=C:\Users\manish_ranjan\.m2\repository -Dpackaging=jar
instead of....
mvn install:install-file -Dfile=C:\Autus1\Autus1_Practice\bundle\target\Autus1_Service-1.0-SNAPSHOT.jar -DgroupId=com.autus1.cq5 -DartifactId=Autus1_Service -Dversion=1.0-SNAPSHOT -DlocalRepositoryPath=C:\Users\manish_ranjan\.m2\repository -Dpackaging=jar
and it worked. :)
The only change was version "1.3" instead of "1.0-SNAPSHOT" which gave me the solution and my project2 started recognizing this dependency from my project1
<dependency>
<groupId>com.autus1.cq5</groupId>
<artifactId>Autus1_Service</artifactId>
<version>1.3</version>
<scope>compile</scope>
</dependency>
Thanks for the clue!

Can't download snapshot artifacts when version is specified by range

In POM could be specified wanted range of artifact version (which in next step will be downloaded by maven-dependency-plugin:copy-dependencies):
<dependencies>
<dependency>
<groupId>my.group</groupId>
<artifactId>hibi-test</artifactId>
<version>[0.1.4-SNAPSHOT,0.2.0)</version>
</dependency>
Problem is that hibi-test has NO releases on my Nexus, - only few SNAPSHOTS (locked timestamp snapshots). I've checked this POM on artifacts which have both releases and snapshots and it worked good, but in that case I've got only:
[ERROR] Failed to execute goal on project Test: Could not resolve dependencies for project my.group:Test:pom:0.0.1-SNAPSHOT: Could not find artifact my.group:hibi-test:jar:0.1.4
Snapshot repository in POM is defined.
I've tried various combination of range, enabling snapshots and versions:unlock-snapshot, but it didn't work. When I passed only 0.1.4-SNAPSHOT artifact hibi-test-0.1.4-SNAPSHOT.jar was downloaded correctly.
What I need here? :)
is 0.2.0 the latest version?
Maybe you should try to change your range of versions.
Try this:
<version> [0.1.4,0.2.0) </version>

Resources