我正在使用gradle(v1.9)和IntelliJIdea(v12.1.6) . 我有一个简单的java项目和一个 build.gradle 文件 . 一个依赖项不在maven central上,所以我将jar放在 lib 文件夹中 .
问题
对于maven central上的依赖项,gradle使用javadoc和source(位于$ project / .idea / libraries)中正确构建库xml文件 . 对于本地依赖项(JNativeHook),不附加此类源或javadoc . 作为比较,两个xml文件:
With source and javadoc attachment
Without source and javadoc attachment
其他信息
构建文件如下所示:
apply plugin: 'java'
apply plugin: 'idea'
idea {
module {
downloadJavadoc = true
downloadSources = true
}
}
repositories {
mavenCentral()
flatDir(dirs: 'lib')
}
dependencies {
// Will be fetched from mavenCentral()
compile 'com.fasterxml.jackson.core:jackson-core:2.2.3'
// Will be fetched from the 'lib' directory (see second repository)
compile 'org.jnativehook:JNativeHook:1.1.4'
}
sourceCompatibility = 1.7
version = '0.1'
jar {
manifest {
attributes 'Implementation-Title': 'ScreenShotter',
'Implementation-Version': version,
'Main-Class': 'de.fau.screenshotter.ScreenShotter'
}
from {
configurations.compile.collect { it.isDirectory() ? it : zipTree(it) }
}
}
我的项目结构如下所示:
问题(tldr;)
如何告诉gradle创建适当的javadoc和源条目并将它们添加到IntelliJ使用的xml文件中?