Best way to hook into assemble task to copy jar to another location?


(Phil Swenson) #1

I want to copy a specific jar from the staging

tasks.getByName("assemble") << {
    // I want to copy the staging/libs output jar to another location
}

Now I know i can just put in copy code there like

new File("/destdir/blah.jar").bytes << new File("$projectDir/staging/lib/myjar.jar")

But this doesn’t seem to be the “gradle” way…

thoughts?


(Peter Niederwieser) #2

The Gradle way would be to create a separate ‘Copy’ task for this. Assemble doesn’t seem like the right “hook” for this, though.