Reputation: 16271
I am working with a multi module project.
The following is mandatory
apply plugin: 'war'
project(':thymeleaf-02-web') {
description 'Web (HTML, JS, CSS)'
dependencies {
exportedProjects.each{
if("$it"!=":thymeleaf-02-web")
compile project("$it")
}
}
webAppDirName = 'src/main/resources'
war {
version=''
baseName = warBaseName
}
}
The value for webAppDirName
with src/main/resources
is totally mandatory, it is not the expected working about with the WEB-INF
location, because I am working with Thymeleaf
, otherwise many @Test
methods fail, it about Testing @Controller
about Spring
.
Now I have the mandatory case that I need for the web app the web.xml
file to configure the <error-page>
. It is located as usual within the src/main/webapp/WEB-INF/
location, but when I create the .war
file and it is deployed the web.xml
never was taken in consideration and thus is not included.
I have tried the following addition:
dependencies {
compile fileTree(dir: "src/main/webapp/WEB-INF/", include: 'web.xml')
runtime fileTree(dir: "src/main/webapp/WEB-INF/", include: 'web.xml')
exportedProjects.each{
if("$it"!=":thymeleaf-02-web")
compile project("$it")
}
}
But nothing. For the moment I must copy/paste manually the web.xml
file into the deployed .war
file.
Thus what is the correct configuration?
Upvotes: 0
Views: 2257
Reputation: 3881
Try using the from()
call in your war
block:
war {
from('src/main/webapp/WEB-INF/web.xml') {
into('WEB-INF')
}
}
Upvotes: 3