How to publish a zip to maven repo, but dynamically set the group/version/etc/etc


(Joe Gamache) #1

I have tried something like this:

uploadArchives {

repositories {

mavenDeployer {

repository(url: “validURLhere”)

pom.version = ‘1.4.0’

uniqueVersion = false

addFilter(‘a’) {artifact, file ->

artifact.name == ‘a’

}

addFilter(‘b’) {artifact, file ->

artifact.name == ‘b’

}

}

}

}

but it wants to use the org name, version, group, etc from the zip when it was created. As can be seen I have multiple Zips being created that I would like to upload (only 2 shown, but there are more). How do I set these on an individual basis?

thanks!


(Peter Niederwieser) #2

You use ‘==’ instead of ‘=’. Does using ‘=’ help?


(Joe Gamache) #3

Help what part? The =='s for what they are doing work fine - the above DOES work, it lets the “artifactId” be different for each Zip file. But I would like to have distinct control over the “groupId” - currently they are both set to the same thing, and I would like to change them both to something different. The only way I know to do this would be to have separate gradle files for each one, but that seems ugly (they would need different file names than simply build.gradle as they would reside in the same directory…)

Same thing for the version number. Can I set that into the respository with different values for each one?


(Peter Niederwieser) #4

Sorry, my fault. ‘addFilter’ returns an object of type ‘org.gradle.api.artifacts.maven.MavenPom’, which you can further customize as needed. See the Gradle Build Language Reference and/or Javadoc for details.