Skip to content

Instantly share code, notes, and snippets.

Created December 11, 2014 02:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/01b31c26eca7a507c14f to your computer and use it in GitHub Desktop.
Save anonymous/01b31c26eca7a507c14f to your computer and use it in GitHub Desktop.
group="test"
version = "1.0.0"
import org.gradle.api.internal.artifacts.publish.DefaultPublishArtifact
apply plugin: 'java'
apply plugin: 'maven'
def aJar = file("build/A.jar")
def bJar = file("build/B.jar")
artifacts{
//archives aJar
//archives bJar
// archives file: file('A.jar'), name: 'A', type: 'jar'
// archives file: file('B.jar'), name: 'B', type: 'jar'
archives new DefaultPublishArtifact("A", "jar", "jar", null, new
Date(), new File("$buildDir", "A.jar"))
archives new DefaultPublishArtifact("B", "jar", "jar", null, new
Date(), new File("$buildDir", "B.jar"))
}
uploadArchives(){
repositories {
mavenDeployer {
addFilter("A") {artifact, file ->
artifact.name == "B"
}
addFilter("B") {artifact, file ->
artifact.name == "B"
}
}
}
}
@muralidcis
Copy link

// addfilter A with b, and the first addfilter inside mavendeployer dosnt works, here is slight change in the upload archives code that worked for me...

uploadArchives(){
repositories {
mavenDeployer {
repository(url: "$archivaUrl") {
authentication(userName: "$userName", password: "$passWord")
}
addFilter("A") {artifact, file ->
artifact.name == "A"
}
addFilter("B") {artifact, file ->
artifact.name == "B"
}
}
}
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment