<build> <resources> <resource> <directory>src/main/java</directory> </resource> <resource> <directory>src/main/resources</directory> <!-- 资源根目录排除各环境的配置,防止在生成目录中多余其它目录 --> <excludes> <exclude>local/*</exclude> <exclude>test/*</exclude> <exclude>pro/*</exclude> <exclude>dev/*</exclude> </excludes> </resource> <resource> <directory>src/main/resources/${profiles.active}</directory> </resource> </resources>
<build> <plugins> <!-- Source attach plugin --> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-resources-plugin</artifactId> <version>3.0.2</version> <executions> <execution> <id>copy-resources</id> <phase>process-resources</phase> <goals> <goal>copy-resources</goal> </goals> <configuration> <outputDirectory>${project.build.outputDirectory}</outputDirectory> <resources> <resource> <directory>src/main/java</directory> <includes> <include>**/*.java</include> </includes> </resource> </resources> </configuration> </execution> </executions> </plugin> </plugins> </build>