您可以使用 mojo copy-resources 复制不在默认 maven 布局中或未在 build/resources 元素中声明的资源并将其附加到阶段
<project> ... <build> <plugins> <plugin> <artifactId>maven-resources-plugin</artifactId> <version>3.2.0</version> <executions> <execution> <id>copy-resources</id> <!-- here the phase you need --> <phase>validate</phase> <goals> <goal>copy-resources</goal> </goals> <configuration> <outputDirectory>${basedir}/target/extra-resources</outputDirectory> <resources> <resource> <directory>src/non-packaged-resources</directory> <filtering>true</filtering> </resource> </resources> </configuration> </execution> </executions> </plugin> </plugins> ... </build> ... </project>