这是我的一个模块的 build.gradle 文件的摘录。我正在使用 安卓工作室1.5.1 和 毕业 2.10 .
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.2.1'
compile 'com.android.support:design:23.2.1'
compile 'com.google.android.gms:play-services-gcm:9.0.0'
compile 'com.squareup.picasso:picasso:2.5.2'
}
我也有
classpath 'com.google.gms:google-services:3.0.0'
在项目级别的 build.gradle 文件中。我正在尝试将所有关联的 jar 收集到一个可以提交到我的 git repo 的目录中。就像是:
task copyRuntimeLibs(type: Copy) {
into "${projectDir}/libs"
from configurations.compile
}
(这不起作用)
另外,我不想下载源代码或 javadocs。
我需要能够提交所有依赖项,以便可以在没有 Internet 访问的情况下在 Intranet 上共享项目。
最佳答案
我写了一个插件,可以下载所有的 jars 和 pom。见代码here从 Gradle Configuration 下载所有 jars 和所有 pom
注意:有一个失败的测试 here这表明父 pom 没有被下载。我提出了一个问题 here在 Gradle 的 github 上。
我可能会改进插件以调用 Maven Model Builder APIs得到父 poms。
仅供引用 - 我已经成功地将 ModelBuilder API 与 Gradle 集成(参见 here 和 here ),所以应该不会太难。
关于android-studio - 在 Android Studio 中下载并提交 gradle 依赖项和插件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37482994/