如何通过Gradle将ojdbc7添加到Java Web应用程序? [英] How to add ojdbc7 to Java web app by Gradle?

查看:763
本文介绍了如何通过Gradle将ojdbc7添加到Java Web应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的上下文:


  • 我构建了一个基于Spring Boot
    1.3.5.RELEASE的Java Web应用程序。

  • 我尝试将 ojdcb 添加到依赖项列表但不成功。

  • 我知道Oracle拥有自己的Maven存储库,价格为
    http://maven.oracle.com

  • I build a Java web application what based on Spring Boot 1.3.5.RELEASE .
  • I try to add ojdcb to dependencies list but not success.
  • I know that Oracle has own Maven repository at http://maven.oracle.com

这是我的 build.gradle 文件,让我们关注第4,5,6行, 36:

This is my build.gradle file, Let focus at line 4, 5, 6, 36:

buildscript {
    repositories {
        mavenCentral()
        maven {
            url ("https://maven.oracle.com")
        }
    }
    dependencies {
        classpath("org.springframework.boot:spring-boot-gradle-plugin:1.3.5.RELEASE")

    }
}

apply plugin: 'war'
apply plugin: 'idea'
apply plugin: 'spring-boot'

jar {
    baseName = 'erp'
    version = '1.0.0'
}

repositories {
    mavenCentral()
}

sourceCompatibility = 1.8
targetCompatibility = 1.8

dependencies {
    compile("org.springframework.boot:spring-boot-starter-thymeleaf")
    //compile("org.springframework.boot:spring-boot-starter-security")
    providedRuntime("org.springframework.boot:spring-boot-starter-tomcat")
    compile("org.springframework.boot:spring-boot-starter-data-jpa")
    compile("org.hibernate:hibernate-core")
    compile("com.oracle.jdbc:ojdbc7:12.1.0.2")
    testCompile("junit:junit")
}

IntelliJ IDEA 2016通知错误:

IntelliJ IDEA 2016 notice error:


警告: 根项目'erp':Web Facets / Artifacts不能正确配置
详细信息:
org.gradle.api.artifacts.ResolveException:无法解析配置':runtime'的所有
依赖项。引起:
org.gradle.internal.resolve.ModuleVersionNotFoundException:
找不到com.oracle.jdbc:ojdbc7:12.1.0.2。要求:
:erp:未指定

(相关链接: http://docs.oracle.com/middleware/1213/core/MAVEN/config_maven_repo.htm#MAVEN9015
https://blogs.oracle.com/dev2dev/entry/how_to_get_oracle_jdbc
https://blogs.oracle.com/dev2dev/entry/oracle_maven_repository_instructions_for

(Related links: http://docs.oracle.com/middleware/1213/core/MAVEN/config_maven_repo.htm#MAVEN9015 https://blogs.oracle.com/dev2dev/entry/how_to_get_oracle_jdbc https://blogs.oracle.com/dev2dev/entry/oracle_maven_repository_instructions_for )

帮助我通过Gradle将 ojdbc 添加到依赖项列表中,谢谢!

Help me add ojdbc to dependencies list by Gradle, thank you!

推荐答案

对于Oracle数据库12c

For Oracle database 12c

(1)下载 ojdbc7.jar 在Oracle主页上。

(1) Download ojdbc7.jar at Oracle homepage.

(2)运行命令

mvn install:install-file -Dfile=ojdbc7.jar -DgroupId=com.oracle -DartifactId=ojdbc7 -Dversion=12.1.0.1 -Dpackaging=jar

(3)添加到 build.gradle

compile('com.oracle:ojdbc7:12.1.0.1')

这篇关于如何通过Gradle将ojdbc7添加到Java Web应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆