是否可以在没有 pom.xml 的情况下发布 Maven 工件?

Cra*_*ing 8 gradle

我们有非常独特的情况。我们正在打包来自不同机器(Ubuntu 和 Windows 7)的 linux 和 Windows 平台的本地二进制文件。我们正在使用标准maven-publish插件。

我们使用相同的 Maven GAV 发布工件,它们仅在classifier. 这会在发布过程中引起问题,因为第二个平台将尝试发布pom.xml已经发布的 . 部署用户没有任何覆盖访问权限。

有没有办法在不发布pom.xml.

lan*_*ava -1

在没有 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']
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

请参阅MavenPublication.artifact(...)

  • 这将不起作用,因为这些工件是在不同的操作系统(Linux 和 Windows)上构建的。一个操作系统无法访问另一个操作系统的工件,反之亦然。 (4认同)