Peter Niederwieser wrote:
>
>
> richardm wrote:
>>
>> However, my questions still stands, can you update a JAR using the Gradle
>> DSL, or is using the Ant task the only way?
>>
>
> Gradle's file handling capabilities make this kind of task easy. For
> example, to add file "some_file.txt" to the META-INF directory of the
> original Jar:
>
> task enrichedJar(type: Jar, dependsOn: "jar") {
> appendix = "enriched"
> from zipTree(jar.archivePath) // add original content
> from(file("some_file.txt")) { // add new content
> into "META-INF"
> }
> }
>
> For more information, see the chapter "Working With Files" in the user
> guide:
> http://gradle.org/latest/docs/userguide/userguide_single.html#working_with_files
>
> --
> Peter Niederwieser
> Developer, Gradle
> http://www.gradle.org
> Trainer & Consultant, Gradleware
> http://www.gradleware.com
> Creator, Spock Framework
> http://spockframework.org
>
Thanks for that. I've stuck with the ant.jar task for now as this allows me
to update an existing JAR. Using your suggested approach I could create a
new jar based on an existing one, but couldn't get it to update the original
JAR, but it's useful to know.
--
View this message in context:
http://gradle.1045684.n5.nabble.com/is-it-possible-to-update-jar-contents-tp3407766p3409606.html
Sent from the gradle-user mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email