Copy multiple files from one sub project to another before building the war file


(Yousuf Mohammed) #1

Hi. I have two sub projects inside my main project. I want to copy a bunch of files from one sub project to another before I build the war. How can I do it in gradle script


(René Groeschke) #2

In general you can do this with a simple Copy task. Have a look at the Gradle userguide (http://www.gradle.org/docs/current/userguide/userguide_single.html#sec:copying_files) to see how the copy task is used. Can you elaborate a bit more what usecase you have in mind when you want to copy sth from projA to projB just before the war is created?

cheers, René


(Yousuf Mohammed) #3

Thanks Rene. I have two sub projects one for UI and other for java classes. At the moment our deployment only accepts one war file. So, I wanted to copy the UI files inside the java project before creating the war. I am using the following piece of code in my build.gradle file:

war {

from project(’:UI project’).file(‘WebContent/ui’)

into file(’/fileName’) }