# Intercept copy task in war pluggin

**URL:** <https://discuss.gradle.org/t/intercept-copy-task-in-war-pluggin/6341>\
**Category:** Old Forum Archive\
**Created:** [September 8, 2014, 5:55pm UTC](https://discuss.gradle.org/t/intercept-copy-task-in-war-pluggin/6341 "2014-09-08T17:55:00Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jorge\_Ezequiel\_Bo](https://avatars.discourse-cdn.com/v4/letter/j/bbe5ce/32.png) [@Jorge\_Ezequiel\_Bo](https://discuss.gradle.org/u/Jorge_Ezequiel_Bo)\
**Post date:** [September 8, 2014, 5:55pm UTC](https://discuss.gradle.org/t/intercept-copy-task-in-war-pluggin/6341/1 "2014-09-08T17:55:00Z")

</div>

hi guys,

I was wondering if it is possible to intercept the copy task in war plugging while copying static resources such as .js and .css to the exploded dir or war file. I would like to to rev filenames.

Thanks, Jorge

---

<div class="post-metadata">

**Author:** ![Rene](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/rene/32/8082_2.png) [@Rene](https://discuss.gradle.org/u/Rene)\
**Post date:** [September 8, 2014, 7:23pm UTC](https://discuss.gradle.org/t/intercept-copy-task-in-war-pluggin/6341/2 "2014-09-08T19:23:00Z")

</div>

Hey Jorge,  
The war task provides a 'rename’method. Have a look at the gradle userguide ([http://www.gradle.org/docs/current/userguide/working\_with\_files.html#sec:copying\_files](http://www.gradle.org/docs/current/userguide/working_with_files.html#sec:copying_files)) or have a look at the gradle dsl reference for details  
  
cheers,  
René  
&nbsp;

---

<div class="post-metadata">

**Author:** ![cmcginty](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/cmcginty/32/2209_2.png) [@cmcginty](https://discuss.gradle.org/u/cmcginty)\
**Post date:** [September 8, 2014, 9:29pm UTC](https://discuss.gradle.org/t/intercept-copy-task-in-war-pluggin/6341/3 "2014-09-08T21:29:00Z")

</div>

You might also need to use the ‘rootSpec’ property for this to work in the ‘war’ task.

[http://forums.gradle.org/gradle/topics/war\_plugin\_rename\_jars\_included\_in\_web\_inf\_lib](http://forums.gradle.org/gradle/topics/war_plugin_rename_jars_included_in_web_inf_lib)

---

<div class="post-metadata">

**Author:** ![Jorge\_Ezequiel\_Bo](https://avatars.discourse-cdn.com/v4/letter/j/bbe5ce/32.png) [@Jorge\_Ezequiel\_Bo](https://discuss.gradle.org/u/Jorge_Ezequiel_Bo)\
**Post date:** [September 11, 2014, 4:29pm UTC](https://discuss.gradle.org/t/intercept-copy-task-in-war-pluggin/6341/4 "2014-09-11T16:29:00Z")

</div>

Thanks, for both answers. Actually i figured out what i need

Besides renaming files, i need to change the name of the .js ,.css files destination directory inside the .war file. I

Change from js/main/ to js/main/v1 and put all my .js and .css file. Is there any copy task in war pluggin?

---

<div class="post-metadata">

**Author:** ![cmcginty](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/cmcginty/32/2209_2.png) [@cmcginty](https://discuss.gradle.org/u/cmcginty)\
**Post date:** [September 13, 2014, 11:16pm UTC](https://discuss.gradle.org/t/intercept-copy-task-in-war-pluggin/6341/5 "2014-09-13T23:16:00Z")

</div>

Try looking up some examples that use the [‘eachFile’](http://www.gradle.org/docs/current/javadoc/org/gradle/api/file/CopySpec.html#eachFile%28org.gradle.api.Action%29) method from the copySpec
