本文介绍了如何使用摇篮建立与所需的库罐子中的子文件夹(如Eclipse)为Android?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Eclipse中,您可以在相邻的子文件夹做创建所需的依赖项目罐子...

In Eclipse, you can create a project jar with its required dependencies in an adjacent sub-folder by doing ...


  • 导出 - > Java的>的Runnable JAR文件

  • Export->Java->Runnable JAR file

选择库操作选项:所需的库旁复制到子文件夹中生成JAR

Select Library handling option: Copy required libraries into a sub-folder next to the generated JAR

有没有办法用摇篮做到这一点?

PS:我的工作的gradle上2.2.1

PS: I am working on gradle 2.2.1

推荐答案

您可以创建复制的摇篮任务,像这样:

You can create a Gradle task for copying, like so:

task copyLibs(type: Copy) {
    from('path/to/dir/with/lib/jars/')
    into('path/to/subfolder/next/to/generated/jar/')
    include('names.jar','of.jar','jars.jar','to.jar','copy.jar')
}

copyLibs.dependsOn(build)

编辑:

task combinedJar(type: Jar) {
   from zipTree("path/to/generated.jar")
   from "path/to/subfolder/next/to/generated/jar/"
}

combinedJar.dependsOn(copyLibs)

通过 gradlew copyLibs 运行。可以使任务依赖于构建项目的生成任务。

Run via gradlew copyLibs. You can make the task depend on the build task that builds your project.

请注意,您可能也必须创建路径/到/子文件夹/下一首/到/生成/ JAR / 任务。

Note that you may have to also create the path/to/subfolder/next/to/generated/jar/ in the task.

这篇关于如何使用摇篮建立与所需的库罐子中的子文件夹(如Eclipse)为Android?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-13 09:41