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

2019-08-29 13:32发布

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

3条回答
兄弟一词,经得起流年.
2楼-- · 2019-08-29 14:22

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楼-- · 2019-08-29 14:26

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.

查看更多
forever°为你锁心
4楼-- · 2019-08-29 14:32

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.

查看更多
登录 后发表回答