I am working with:
Spring FrameworkThymeleafGradle
with multimodules
For testing purposes between modules is mandatory have the html files and js css files within the src/main/resources (and not within src/main/webapp/WEB-INF how is expected)
Thus as follows
@Bean
public SpringResourceTemplateResolver templateResolver() {
SpringResourceTemplateResolver templateResolver = new SpringResourceTemplateResolver();
templateResolver.setApplicationContext(applicationContext);
templateResolver.setPrefix("classpath:/templates/html/");
templateResolver.setSuffix(".html");
templateResolver.setTemplateMode(TemplateMode.HTML);
return templateResolver;
}
To generate the .war file I use:
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/webapp'
webAppDirName = 'src/main/resources' //<--- mandatory now
war {
version=''
baseName = warBaseName
}
...
}
The .war generated and deployed works in runtime, but it has the following structure:
It has twice the static and templates directories. I have confirmed the following:
-
thymeleaf-02/templatesis not necessary (so, is removed manually) -
thymeleaf-02/WEB-INF/classes/staticis not necessary (so, is removed manually)
Thus how in the war task can be configured to remove or avoid the unnecessary creation or generation of these two directory/paths when the .war be generated?
