java ojdbc7,如何通过Gradle将ojdbc7添加到Java Web应用程序?

My context:

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

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 notice error:

Warning:root project 'erp': Web Facets/Artifacts will not be

configured properly Details:

org.gradle.api.artifacts.ResolveException: Could not resolve all

dependencies for configuration ':runtime'. Caused by:

org.gradle.internal.resolve.ModuleVersionNotFoundException: Could not

find com.oracle.jdbc:ojdbc7:12.1.0.2. Required by:

:erp:unspecified

gq46D.jpg

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

解决方案

For Oracle database 12c

(1) Download ojdbc7.jar at Oracle homepage.

(2) Run command

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

(3) Add to build.gradle

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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值