我们有非常独特的情况。我们从不同的机器(Ubuntu和Windows7)打包来自linux和Windows平台的本机二进制文件。我们使用标准的maven-publish插件。
我们使用相同的Maven发布工件,它们只是在classifier上有所不同。这在发布过程中造成了问题,因为第二个平台将尝试发布已经发布的pom.xml。部署用户没有故意的覆盖访问权限。
有没有办法在不发布pom.xml的情况下发布maven工件?
发布于 2021-10-19 14:30:24
我使用IvyPublication来实现这一点。我发现了这个线程,因为我试图清理脚本,只使用一个插件,并试图用Maven替换常春藤出版物,但却发现它正在生成一个pom。
如果你碰巧使用了artifactory plugin,默认情况下有一个全局配置选项publishPom = true,它可以被关闭。
在我的例子中,我确实希望为jar文件发布pom,但我也发布了不需要pom的rpm。
apply plugin: 'ivy-publish'
publishing {
publications {
rpm(IvyPublication) {
organisation publishGroup
//We'll set the version and module when we build the rpm
}
}
}
buildRpm{
...
publishing.publications.rpm.setModule(rpmName)
publishing.publications.rpm.setRevision(rpmVersion)
//add rpm to publications
publishing.publications.rpm.artifact(destFile) {
type "rpm"
extension "rpm"
builtBy buildRpm
}
}发布于 2016-12-14 21:32:22
不使用pom.xml发布到maven是没有意义的。试试这个:
apply plugin: 'maven-publish'
task ubuntuZip(type: Zip) {
classifier 'ubuntu'
// TODO configure
}
task windows7Zip(type: Zip) {
classifier 'windows7'
// TODO configure
}
publishing {
publications {
maven(MavenPublication) {
artifact ubuntuZip
artifact windows7Zip
artifact [source: 'path/to/random/file.txt', classifier: 'foo']
}
}
}发布于 2019-04-10 05:50:17
您需要pom.xml文件作为依赖项,该文件包含有关工件的更多信息。
https://stackoverflow.com/questions/41141742
复制相似问题