3

I am having problems trying to build my project with maven, more specifically when a dependency is required, that of Oracle JDBC 7, I have been looking for a solution for hours and nothing, even consult some of the questions raised regarding that here but nothing

C:\Users\E10697\Desktop\Contenedores\oracle_contenedores\Entorno-Oracle-sobre-Docker-master\4. Consumo de la Oracle DB a través de un API Rest\4.1. Elaboración del API Rest\4.1.2. Implementación de una API Rest\OpenwebinarDockerAPI - RESUELTO\OPENWE~1>mvn clean install

error: [ERROR] Failed to execute goal on project app-rest-api: Could not resolve dependencies for project openwebinar.marvel.app:app-rest-api:war:0.1.0-SNAPSHOT: Could not find artifact com.oracle:ojdbc7:jar:12.1.0 in spring-milestones (https://repo.spring.io/milestone)

[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO]
[INFO] rest-api                                                           [pom]
[INFO] app-rest-api                                                       [war]
[INFO] app-web                                                            [war]
[INFO]
[INFO] ---------------------< openwebinar.marvel.app:app >---------------------
[INFO] Building rest-api 0.1.0-SNAPSHOT                                   [1/3]
[INFO] --------------------------------[ pom ]---------------------------------
[INFO]
[INFO] --- maven-clean-plugin:3.0.0:clean (default-clean) @ app ---
[INFO]
[INFO] --- maven-install-plugin:2.5.2:install (default-install) @ app ---
[INFO] Installing C:\Users\E10697\Desktop\Contenedores\oracle_contenedores\Entorno-Oracle-sobre-Docker-master\4. Consumo de la Oracle DB a través de un API Rest\4.1. Elaboración del API Rest\4.1.2. Implementación de una API Rest\OpenwebinarDockerAPI - RESUELTO\OPENWE~1\pom.xml to C:\Users\E10697\.m2\repository\openwebinar\marvel\app\app\0.1.0-SNAPSHOT\app-0.1.0-SNAPSHOT.pom
[INFO]
[INFO] ----------------< openwebinar.marvel.app:app-rest-api >-----------------
[INFO] Building app-rest-api 0.1.0-SNAPSHOT                               [2/3]
[INFO] --------------------------------[ war ]---------------------------------
Downloading from spring-milestones: https://repo.spring.io/milestone/com/oracle/ojdbc7/12.1.0/ojdbc7-12.1.0.pom
Downloading from repository.springframework.maven.release: http://maven.springframework.org/milestone/com/oracle/ojdbc7/12.1.0/ojdbc7-12.1.0.pom
Downloading from org.springframework: http://maven.springframework.org/snapshot/com/oracle/ojdbc7/12.1.0/ojdbc7-12.1.0.pom
Downloading from spring-milestone: http://repo.spring.io/libs-milestone/com/oracle/ojdbc7/12.1.0/ojdbc7-12.1.0.pom
Downloading from spring-release: http://repo.spring.io/libs-release/com/oracle/ojdbc7/12.1.0/ojdbc7-12.1.0.pom
Downloading from central: https://repo.maven.apache.org/maven2/com/oracle/ojdbc7/12.1.0/ojdbc7-12.1.0.pom
[WARNING] The POM for com.oracle:ojdbc7:jar:12.1.0 is missing, no dependency information available
Downloading from spring-milestones: https://repo.spring.io/milestone/com/oracle/ojdbc7/12.1.0/ojdbc7-12.1.0.jar
Downloading from repository.springframework.maven.release: http://maven.springframework.org/milestone/com/oracle/ojdbc7/12.1.0/ojdbc7-12.1.0.jar
Downloading from org.springframework: http://maven.springframework.org/snapshot/com/oracle/ojdbc7/12.1.0/ojdbc7-12.1.0.jar
Downloading from spring-milestone: http://repo.spring.io/libs-milestone/com/oracle/ojdbc7/12.1.0/ojdbc7-12.1.0.jar
Downloading from spring-release: http://repo.spring.io/libs-release/com/oracle/ojdbc7/12.1.0/ojdbc7-12.1.0.jar
Downloading from central: https://repo.maven.apache.org/maven2/com/oracle/ojdbc7/12.1.0/ojdbc7-12.1.0.jar
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary for rest-api 0.1.0-SNAPSHOT:
[INFO]
[INFO] rest-api ........................................... SUCCESS [  0.590 s]
[INFO] app-rest-api ....................................... FAILURE [  3.732 s]
[INFO] app-web ............................................ SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  4.762 s
[INFO] Finished at: 2020-01-03T15:36:54-04:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project app-rest-api: Could not resolve dependencies for project openwebinar.marvel.app:app-rest-api:war:0.1.0-SNAPSHOT: Could not find artifact com.oracle:ojdbc7:jar:12.1.0 in spring-milestones (https://repo.spring.io/milestone) -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR]   mvn <args> -rf :app-rest-api

The app-rest-api pom.xml:

<?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>

    <artifactId>app-rest-api</artifactId>
    <version>0.1.0-SNAPSHOT</version>
    <packaging>war</packaging>

    <parent>
        <groupId>openwebinar.marvel.app</groupId>
        <artifactId>app</artifactId>
        <version>0.1.0-SNAPSHOT</version>
    </parent>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <java.version>1.8</java.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-jpa</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>org.apache.tomcat</groupId>
                    <artifactId>tomcat-jdbc</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <dependency>
            <groupId>com.oracle</groupId>
            <artifactId>ojdbc7</artifactId>
            <version>12.1.0</version>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>

</project>

My project structure, in this case I am running the mvn clean install command in the operwebinar_mavel folder:

enter image description here

What is in the maven route:

C: \ Users \ E10697 \ .m2 \ repository \ com \ oracle \ ojdbc7 \ 12.1.0

enter image description here

Cesar Justo
  • 707
  • 2
  • 11
  • 35
  • Hola Cesar, have you checked that the oracle driver is actually located at the default maven repo you are using?, I had a similar issue and had to add the corresponding repository where the driver is in. – lazha Jan 03 '20 at 20:00
  • 1
    Does this answer your question? [Find Oracle JDBC driver in Maven repository](https://stackoverflow.com/questions/1074869/find-oracle-jdbc-driver-in-maven-repository) – werner Jan 04 '20 at 20:09
  • It worked for me thank you very much, and this question did not answer my question https://stackoverflow.com/questions/1074869/find-oracle-jdbc-driver-in-maven-repository – Cesar Justo Jan 05 '20 at 16:29

1 Answers1

8

Add the Repository to your POM and it will work:

<repositories>
    <repository>
        <id>hand-china-repo</id>
        <name>HandChinaRepo</name>
        <url>http://nexus.saas.hand-china.com/content/repositories/rdc/</url>
    </repository>
</repositories>

The repo is listed on the Maven Repository page: https://mvnrepository.com/artifact/com.oracle/ojdbc7/12.1.0.2

Maven Central is reporting a similar dependency at version 12.1.0.2. Try changing your POM to match:

<!-- https://mvnrepository.com/artifact/com.oracle/ojdbc7 -->
<dependency>
    <groupId>com.oracle</groupId>
    <artifactId>ojdbc7</artifactId>
    <version>12.1.0.2</version>
</dependency>

I tested and this combination of adding the repo and the exact version works for me.

KevinB
  • 1,102
  • 2
  • 8
  • 19