我正在使用gradle(v1.9)和IntelliJIdea(v12.1.6)。我有一個簡單的java項目和一個build.gradle
文件。一個依賴不在Maven中心,所以我已經把罐子放在lib
文件夾中。Gradle:將源代碼和javadoc連接到IntelliJIdea中的本地文件
問題
對於那些Maven的中央的依賴,建立gradle這個庫的XML文件正確地將與Javadoc和源(位於$項目/ .idea /庫)。對於本地依賴(JNativeHook),不附加這樣的源代碼或javadoc。作爲比較,兩個XML文件:
隨着源和javadoc附件
<component name="libraryTable">
<library name="jackson-core-2.2.3">
<CLASSES>
<root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/com.fasterxml.jackson.core/jackson-core/2.2.3/1a0113da2cab5f4c216b4e5e7c1dbfaa67087e14/jackson-core-2.2.3.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/com.fasterxml.jackson.core/jackson-core/2.2.3/6021971970a43ae0c22f378cfb5813af869caab/jackson-core-2.2.3-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/com.fasterxml.jackson.core/jackson-core/2.2.3/b1c4a6c3c26dfc425efd53c00217868b60d07de9/jackson-core-2.2.3-sources.jar!/" />
</SOURCES>
</library>
</component>
沒有源和javadoc附件
<component name="libraryTable">
<library name="JNativeHook-1.1.4">
<CLASSES>
<root url="jar://$PROJECT_DIR$/lib/JNativeHook-1.1.4.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</component>
附加信息
構建文件看起來像這樣:
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和源項,並將它們添加到XML IntelliJ使用的文件?
也面臨同樣的問題,但與eclipse .classpath文件,而不是intelliJ。 – icyitscold