How create file and put it in a war with Maven?

雨燕双飞 提交于 2019-12-25 04:57:06

问题


How I can create file and put it in a war with Maven when building the war?


回答1:


Maven builds a war by executing the war goal of the maven-war plugin. Have a look at the configuration parameters of this goal at http://maven.apache.org/plugins/maven-war-plugin/war-mojo.html.

Basically, warSourceDirectory (defaulting to ${basedir}/src/main/webapp) contains the files that go to the war, apart from your java code and resources. Fine tune with packagingIncludes/packagingExcludes. To include file(s) from another module, use overlay: http://maven.apache.org/plugins/maven-war-plugin/overlays.html.




回答2:


I'm assuming that you want a file that gets put on the classpath when your .jar or .war is assembled. You likely want to put it in src\main\resources.




回答3:


assuming your using eclipse+maven. put it Java resources>> package you want

then right click on the project maven>> update project. run the new pom.xml you'll get the new .war with everything in place.



来源:https://stackoverflow.com/questions/12842957/how-create-file-and-put-it-in-a-war-with-maven

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!