我的背景:
- 我正在构建一个基于Spring Boot 1.3.5.RELEASE的Java Web应用程序。
- 我尝试将
ojdcb
添加到依赖列表中,但没有成功。 - 我知道Oracle在
http://maven.oracle.com
上有自己的Maven仓库。
这是我的build.gradle
文件,请关注第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提示错误:
警告:根项目'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 )
请帮我通过Gradle将ojdbc
添加到依赖列表中,谢谢!
repositories { ... }
部分中定义,而不是在buildscript { ... }
内部定义。 - jschreiner