It appears that the eclipse plugin uses the following mechanism to do this:

apply plugin: 'java'

apply plugin: 'eclipse'

eclipse {

classpath {

downloadSources=true

}

}

but I can't find a corresponding option for the idea plugin. What am I missing?

Here's the build.gradle file:

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'

}

解决方案

I've got problems with the following configuration:

idea {

module {

// if you hate browsing Javadoc

downloadJavadoc = false

// and love reading sources :)

downloadSources = true

}

}

repositories {

mavenLocal()

mavenCentral()

}

When removed mavenLocal() sources were downloaded and attached.

Logo

开放原子开发者工作坊旨在鼓励更多人参与开源活动,与志同道合的开发者们相互交流开发经验、分享开发心得、获取前沿技术趋势。工作坊有多种形式的开发者活动,如meetup、训练营等,主打技术交流,干货满满,真诚地邀请各位开发者共同参与!

更多推荐