gpt4 book ai didi

java - 尝试将 ojdbc7 安装为 Maven 依赖项时出现问题

转载 作者:行者123 更新时间:2023-11-30 01:42:07 26 4
gpt4 key购买 nike

我在尝试使用 Maven 构建项目时遇到问题,更具体地说,当需要依赖项时,Oracle JDBC 7 的依赖项,我一直在寻找解决方案几个小时,但一无所获,甚至咨询了有关该问题的一些问题这里什么都没有

C:\Users\E10697\Desktop\Contenedores\oracle_contenedores\Entorno-Oracle-sobre-Docker-master\4。 Oracle DB 的使用来自 API Rest\4.1。 API Rest 详细说明\4.1.2。实现 API Rest\OpenwebinarDockerAPI - RESUELTO\OPENWE~1>mvn clean install

错误:[错误] 无法在项目 app-rest-api 上执行目标:无法解析项目 openwebinar.marvel.app:app-rest-api:war:0.1.0-SNAPSHOT 的依赖项:可以在 spring-milestones ( https://repo.spring.io/milestone ) 中找不到 Artifact com.oracle:ojdbc7:jar:12.1.0

[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

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>

我的项目结构,在本例中,我在 operwebinar_mavel 文件夹中运行 mvn clean install 命令:

enter image description here

maven 路由中有什么:

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

enter image description here

最佳答案

将存储库添加到您的 POM 中,它将起作用:

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

该存储库列在 Maven 存储库页面上: https://mvnrepository.com/artifact/com.oracle/ojdbc7/12.1.0.2

Maven Central 在版本 12.1.0.2 中报告了类似的依赖关系。尝试更改您的 POM 以匹配:

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

我进行了测试,添加存储库和确切版本的这种组合对我来说很有效。

关于java - 尝试将 ojdbc7 安装为 Maven 依赖项时出现问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59584499/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com