Gradle无法发布多个maven本机构件
我似乎无法让Gradle将多个工件发布到Maven存储库中。它出版了一些,但不是全部,我不知道为什么。目标是为OSX和Windows构建的静态库的调试和发布版本(总共4个静态库)。OSX库已存储,但Windows库未存储。如果修改过滤器闭包,以便过滤掉OSX库,则不会存储任何内容Gradle无法发布多个maven本机构件,maven,gradle,artifact,Maven,Gradle,Artifact,我似乎无法让Gradle将多个工件发布到Maven存储库中。它出版了一些,但不是全部,我不知道为什么。目标是为OSX和Windows构建的静态库的调试和发布版本(总共4个静态库)。OSX库已存储,但Windows库未存储。如果修改过滤器闭包,以便过滤掉OSX库,则不会存储任何内容 model { buildTypes { debug release } platforms { "osx-x86_64" { operatingSystem "o
model {
buildTypes {
debug
release
}
platforms {
"osx-x86_64" {
operatingSystem "osx"
architecture "x86_64"
}
"windows-x86_64" {
operatingSystem "windows"
architecture "x86_64"
}
}
toolChains {
// OS X and Windows toolchains (Clang and Mingw) described here
// - they build the artifacts I wish to store ok
// just removed for clarity
}
} // end of model
libraries {
saveMe {}
}
nativeArtifacts {
libSaveMe {
from (libraries.saveMe) { it instanceof StaticLibraryBinary &&
(it.targetPlatform.name == "osx-x86_64" ||
it.targetPlatform.name == "windows-x86_64")
// if I make this closure on the line above something like:
// it instanceof StaticLibraryBinary && it.targetPlatform.name == "windows-x86_64"
// then nothing is saved in the Maven repo
}
}
}
publishing {
repositories {
maven {
credentials {
username = 'user'
password = 'password'
}
url "http://hostname.com/path/to/repo"
}
}
publications {
mavPub(MavenPublication) {
from nativeArtifacts.libSaveMe
}
}
}
我正在使用一个非常好的外部插件(,由Serge Gebhardt@sgeb(?)编写),但在我试图理解他的代码之前(我是Gradle的初学者),我想我应该问一下,看看是否有明显的错误
我已经尝试将logger语句放入过滤器闭包中,我可以看到正在尝试调试/发布静态/共享库的所有可能组合,并且过滤器正确地识别了是否应该保存库,但它无法保存到Maven
我是否可以在发布{}(或任务)时设置调试行,以查看nativeArtifacts.libSaveMe集合的实际内容?好的,所以这个故事的寓意是:永远不要假设,检查。在本例中,请检查语句:
toolChains {
// OS X and Windows toolchains (Clang and Mingw) described here
// - they build the artifacts I wish to store ok
// just removed for clarity
}
事实上是这样的。事实并非如此
发布任务由CI服务器完成,工具链无法在CI服务器上构建windows构件,但它在我的本地计算机上工作(由于安装mingw工具链时出现配置错误)。工具链失败是在没有错误的情况下发生的(除非在--debug中运行),因此对我来说是不可见的,因为工具链被一个没有创建工件的非Windows编译器替换