Maven war 插件 - 包括 WAR 中的其他文件

Maven war plugin - including other files in WAR

我正在构建一个基于 Maven 的 Java 网络应用程序。在我的 src/main/java/package 文件夹中,我有一个 .xml 文件和一个 .properties 文件,它们需要作为我的 war 的一部分包含在内。但是,当我查看生成的 war 文件(使用 Maven 安装)时,这不包括 .xml 和 .properties 文件。它只包含包中的 .class 文件。

是否可以在 war 中包含这些文件?

此外,我还检查了target/classes文件夹下,这里又没有包含.xml和.properties文件。

将您的 .xml 文件和 .properties 文件放入项目的资源文件夹中,默认情况下 Maven 将从那里获取。

我在 Whosebug 上再用谷歌搜索得到了答案。我只需要更改 maven 的默认资源文件夹作为以下 Whosebug 问题 Why does maven not copy the properties files during the build process?.

中的大纲