-
-
Save behrangsa/2e44c7bdd44171260123469b5144b1af to your computer and use it in GitHub Desktop.
Maven publication closure is evaluated too early
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
group 'org.behrang.labs' | |
version '1.0-SNAPSHOT' | |
apply plugin: 'maven-publish' | |
repositories { | |
mavenCentral() | |
} | |
task clean { | |
doLast { | |
println "clean" | |
if (buildDir.exists()) { | |
buildDir.listFiles().each { f -> f.delete() } | |
} | |
} | |
} | |
task randomArtifacts { | |
doLast { | |
println "randomArtifacts" | |
buildDir.mkdirs(); | |
def artifactCount = (int) (Math.random() * 9) + 1 | |
(1..artifactCount).each { | |
new File(buildDir, "artifact-${it}.rpm").text = "Artifact ${it}" | |
} | |
println "Created ${artifactCount} artifacts." | |
} | |
} | |
publishing { | |
publications { | |
mavenRpm(MavenPublication) { | |
println "mavenRpm" | |
def rpms = buildDir.listFiles({ f -> f.name.endsWith(".rpm")} as FileFilter) | |
rpms.each { f -> | |
println f.absolutePath | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment