Java 带IntelliJ的Gradle不作为依赖项加载PostgreSQL JDBC
我正试图为我的下一个项目设置IntelliJ以及Gradle和JOOQ。现在,我的Gradle文件是这样的:Java 带IntelliJ的Gradle不作为依赖项加载PostgreSQL JDBC,java,maven,intellij-idea,gradle,Java,Maven,Intellij Idea,Gradle,我正试图为我的下一个项目设置IntelliJ以及Gradle和JOOQ。现在,我的Gradle文件是这样的: apply plugin: 'java' apply plugin: 'jooq' sourceCompatibility = 1.5 version = '1.0' repositories { mavenCentral() } dependencies { testCompile group: 'junit', name: 'junit', version: '
apply plugin: 'java'
apply plugin: 'jooq'
sourceCompatibility = 1.5
version = '1.0'
repositories {
mavenCentral()
}
dependencies {
testCompile group: 'junit', name: 'junit', version: '4.11'
}
dependencies {
compile 'org.jooq:jooq:3.1.0'
compile 'com.google.guava:guava:14.0'
compile 'postgresql:postgresql:9.1-901-1.jdbc4'
}
buildscript {
repositories {
mavenLocal()
mavenCentral()
}
dependencies {
classpath 'postgresql:postgresql:9.1-901-1.jdbc4'
classpath 'com.github.ben-manes:gradle-jooq-plugin:0.5'
}
}
jooq {
... snip ...
}
这就是我的外部依赖项(在IntelliJ中)的显示方式:
不知何故,Gradle正在下载,IntelliJ已经认识到jooq和番石榴是我依赖的一部分,但postgresql没有出现。因此,在这样做时(使用Guava,从Gradle加载的依赖项):
在进行
/gradlew构建时,我看到gradle输出了一个事实,即它确实从Maven Central下载了thr postgresql-9.1-901 jar,但我不知道它放在哪里。非常感谢您的帮助。显然,我真的需要RTFM。在对Gradle脚本进行更改后,我没有从IntelliJ中的Gradle工具窗口刷新依赖项。从这里得到:
List<String> stringList = Lists.newArrayList();
Class.forName("org.postgresql.Driver").newInstance();