开发者

How can I make gradle include *.ftl files in war file

开发者 https://www.devze.com 2023-04-05 10:27 出处:网络
I have the following structure: src/main/java/com/company/SomeJavaFile.java src/main/java/com/company/template_file.ftl

I have the following structure:

src/main/java/com/company/SomeJavaFile.java
src/main/java/com/company/template_file.ftl

When I create a build using gradle开发者_StackOverflow, the *.ftl files dont get included in the war file.

How can I make gradle include them in the war file?


Another solution would be to put your *.ftl files into src/main/resources directory instead.


Ok, found it. You simply add the following line to your build file:

gradle.build file (add the following line):

sourceSets.main.resources.srcDir 'src/main/java'

Got the answer from the following discussion thread:

http://gradle.1045684.n5.nabble.com/Copy-non-java-files-into-the-target-directory-td1432058.html


Why not put them in src/main/webapp where, if you used them, *.jsp files would go?

0

精彩评论

暂无评论...
验证码 换一张
取 消