For IvyPublications (ivy-publish), how to publish with [conf] in artifact pattern?


(Dave Smith) #1

In short… here is my pattern:

[organisation]/[module]/[revision]/[artifact]-[revision](+[conf]).[ext]

For these values…

  • organisation = com.me
  • module = foo
  • revision = 1.2.3
  • artifact = foo
  • ext = zip
  • conf = vc140_x86-64.debug

I would like to generate an artifact at:

com.me/foo/1.2.3/foo-1.2.3+vc140_x86-64.debug.zip

But when I publish, it omits the optional ‘+[conf]’ portion. If I remove the parentheses to make it not optional, it appends ‘+[conf]’ to the artifact file’s basename, literally with no value substitution.

What do I need to do for this to work? That configuration metadata is pretty important to have in an artifact filename.

In terms of how I’m setting it up… I’ve tried a lot of things. Here is the latest experimental code, but it varies minute to minute as I try different things :slight_smile:

void setupPublishing(Project project) {
        project.publishing.publications {
            ivyArtifact(IvyPublication) {
                organisation project.group
                module project.name
                revision project.version
                configurations.create(project.buildConfig)
                artifact(project.tasks.jar) {
                    conf project.buildConfig
                }
            }
        }
    }
}

(Dave Smith) #2

Er… I’m seeing here in DefaultIvyArtifact.java that it doesn’t take conf in its constructor along with other items like name, extension, type, and classifier… I haven’t looked at how/where this is used but I think its an ominous sign that the conf is completely dropped on the floor? Am I wrong?

If I change “conf” to classifier in the pattern as well as in the IvyPublication config I get a well-named artifact. I’m actually partitioning the repo with prefixes to the pattern (which I didn’t mention) previously that has “branch/configuration” first, so this might be ok for a while. I’d still like to solve this more correctly, obviously it is pretty hacky to stick things in classifier due to lack of proper conf value.