Hi there,
I’ve seen many answer to similar questions, but none address exactly my need, so I’m asking for advice.
Here is the question: I need to create a war file for my app.
I need to build two different versions of the war: a “debug” and a “release”. The two archives must have a different skin, and I can accomplish this task replacing some files with copies of the file contained in a “themes” folder.
So I have inside my build.gradle the following tasks:
// This is the war task that comes from the war plugin
war {
appendix "debug"
}
// This is the war task that is used to create the release
task warRelease (type: War) {
from( THEMES_FOLDER)
appendix "release"
}
So far, so good.
The project contains the file “courtesy.html” (in the ‘src/main/webapp’ folder), which is included in both the wars.
Now, I have a “THEMES_FOLDER” folder, outside my project. I need to replace the “courtesy.html” file that is in the src/main/webapp folder, with the one included in the themes folder, so I would like to exlude from the warRelease the “courtesy.html” file that is contained inside the web app.
These are my (failed) attempts:
task warRelease (type: War) {
// exclude('courtesy.html') //1: not working, will exclude ALSO the file contained inside the themes folder
// exclude('src/main/webapp/courtesy.html') // 2 not working, seems to be ignored
//from( new File('src/main/webapp'), { // 3 not working, seems to be ignored like attempt 2
// exclude('courtesy.html')
//})
// rootSpec.exclude("coutesy.html") // 4 not working, will exclude ALSO the file contained inside the themes folder
from( THEMES_FOLDER)
appendix "release"
}
I know that, including both files, the last one will be server by the appserver, so I will anyway reach my goal, but I would like to exclude redundant files to reduce war size and for the sake of clarity.
Can someone help me?
Thanks in advance!