看起来eclipse插件使用了以下机制来实现这一点:
apply plugin: 'java'
apply plugin: 'eclipse'
eclipse {
classpath {
downloadSources=true
}
}但是我找不到一个与idea插件相对应的选项。我遗漏了什么?
下面是build.gradle文件:
apply plugin: 'groovy'
apply plugin: 'idea'
repositories {
mavenCentral()
mavenRepo name: "Grails", url: "http://repo.grails.org/grails/repo/"
}
dependencies {
groovy 'org.codehaus.groovy:groovy-all:2.0.4'
compile 'org.slf4j:slf4j-log4j12:1.6.6', 'postgresql:postgresql:9.1-901.jdbc4', 'net.sourceforge.nekohtml:nekohtml:1.9.16'
['core', 'hibernate', 'plugin-datasource', 'plugin-domain-class'].each { plugin ->
compile "org.grails:grails-$plugin:2.1.0"
}
}
idea {
module {
downloadJavadoc = true
downloadSources = true
}
}
// Fat Jar Option (http://docs.codehaus.org/display/GRADLE/Cookbook#Cookbook-Creatingafatjar)
jar {
from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } }
}
task wrapper(type: Wrapper) {
gradleVersion = '1.0'
}发布于 2019-09-20 20:56:51
对于Kotlin DSL:
plugins {
idea
}
idea {
module {
isDownloadJavadoc = true
isDownloadSources = true
}
}发布于 2017-07-30 18:11:18
我注意到,如果您已经下载了一个jar,那么在更改build.gradle之后不能下载它的源代码。
从我的主目录中删除.m2并调用gradle是有帮助的。
发布于 2018-11-07 11:11:41
如果由于对快照jar的依赖(或其他原因)而需要保留mavenLocal()存储库,则可以使用maven获取源代码jar。
mvn dependency:get -Dartifact=GROUP_ID:ARTIFACT_ID:VERSION:jar:sources例如,
mvn dependency:get -Dartifact=org.springframework:spring-core:5.1.2.RELEASE:jar:sourceshttps://stackoverflow.com/questions/12718753
复制相似问题