Is it possible to configure the java-library-distribution plugin to produce multiple archives? I was thinking of DSL similar to (which doesn’t work as I’d like):
distributions {
main {
baseName = archivesBaseName
contents {
into(‘bin’) {
from { ‘scripts’ }
}
into(‘resources’) {
from { ‘src/main/resources/prod’ }
}
into(‘lib’) {
from { ‘build/libs’ }
}
}
}
itest {
baseName = ‘itest’
contents {
into(‘bin’) {
from { ‘scripts’ }
}
into(‘resources’) {
from { ‘src/main/resources/itest’ }
}
into(‘lib’) {
from { ‘build/libs’ }
}
}
} }
What exactly is the behavior you are seeing? Are both distributions not being created?
Given the configuration above, the second block (itest) is just ignored. If I configure two “distributions” sections (with different baseNames), only the second one is executed.
I’m not able to reproduce this problem. What version of Gradle are you using? Do the zip and tar tasks show for the ‘itest’ distribution when running ‘gradle tasks’?
Ah, I see my confusion now. The additional archives (ones not named “main”) actually create separate tasks that must be invoked individually, i.e. gradle clean build distZip itestDistZip. That did the trick.
While I have your ear, do you have any thoughts on http://forums.gradle.org/gradle/topics/can-the-java-library-distribution-plugin-place-the-main-artifact-jar-in-the-lib-directory-as-well?
In a nutshell, I would prefer the main artifact of the build be copied to the lib directory, not the top-level of the distribution. Thanks for your help!
You may be using and older version of Gradle. With 2.3 running ‘assemble’ also ran all the distribution tasks.
I’ve also commented on your other issue.