在Gradle工件中包含文件夹 [英] Include folder in Gradle artifact
问题描述
我想要这样做,但是这是很漫长的一天,Gradle的文档让我在最好的时候感到沮丧(我看过)。在一个预定义的工件( bundleRelease
)中包含一个文件夹( libs
)。
这恰好在android(aar build)和 maven-publish
块中,比如
...
releaseJar(MavenPublication){
...
artifact bundleRelease
}
...
使用gradle 2.3。
感谢这里的任何帮助:)
编辑:在这里回答包括/ libs /文件夹在aar 取决于如果你想要 aar
jar
文件, android {
...
sourceSets {
main {
resources.includes = [ '** / libs / *。jar']
}
}
如果你想包括整个文件夹,那么我认为这应该是你想要的
android {
...
sourceSets {
main {
resources.includes = ['pathTo / libs']
}
}
所有这些都表示您可能不希望用<$ c $因为如果你发布到像 jcenter
或 mavenCentral
之类的地方,那么maven artifact当上传时会创建一个 pom
文件,它会记下它的依赖关系,gradle会将它们透明地导入到你的lib中。
Im sure this is amazingly simple but its been a long day and the Gradle docs frustrate me at the best of times (I have looked).
I want to include a folder (libs
) inside a predefinined artifact (bundleRelease
).
This happens to be on android (aar build) and inside a maven-publish
block like
...
releaseJar(MavenPublication) {
...
artifact bundleRelease
}
...
using gradle 2.3.
Thanks for any help here :)
EDIT: answered here Include /libs/ folder in aar
Depends on what you want for the syntax but if you want the jar
files in the root of the aar
android {
...
sourceSets {
main {
resources.includes = [ '**/libs/*.jar' ]
}
}
If you want the entire folder included then I think this should be what you want
android {
...
sourceSets {
main {
resources.includes = [ 'pathTo/libs' ]
}
}
All that said you probably don't want to package the libs with the aar
because if you publish to somewhere like jcenter
or mavenCentral
then the maven artifact when uploaded will create a pom
file that will note its dependencies and gradle will transparently import them for your lib.
这篇关于在Gradle工件中包含文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!