如何在IDEA中下载Gradle项目的依赖项源代码? [英] How to download dependency sources for Gradle project in IDEA?

查看:4235
本文介绍了如何在IDEA中下载Gradle项目的依赖项源代码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

看来,eclipse插件使用以下机制来执行此操作:

  apply plugin :'java'
apply plugin:'eclipse'

eclipse {
classpath {
downloadSources = true
}
}

但是我找不到相应的插件。我缺少什么?



以下是build.gradle文件:

  apply plugin:'groovy'
apply plugin:'idea'

repositories {
mavenCentral()
mavenRepo name:Grails ,url:http://repo.grails.org/grails/repo/
}

依赖关系{
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']。每个{plugin - >
compileorg.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()?它:zipTree(it)}}
}

任务包装(类型:包装){
gradleVersion ='1.0'
}

解决方案

我遇到以下配置问题:

 
idea {
module {
//如果您讨厌浏览Javadoc
downloadJavadoc = false

//并且喜欢阅读资源:)
downloadSources = true
}
}

存储库{
mavenLocal()
mavenCentral()
}

删除 mavenLocal()来源被下载并附加。


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.

这篇关于如何在IDEA中下载Gradle项目的依赖项源代码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆