通过在pom.xml中添加<includes> / <include>或<excludes> / <exclude>来指定要包含或排除的文件集模式列表。
<project> ... <build> <plugins> ... <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-jar-plugin</artifactId> <version>3.2.2</version> <configuration> <includes> <include>**/service/*</include> </includes> </configuration> </plugin> ... </plugins> </build> ... </project>
请注意,模式需要相对于为插件的classesDirectory参数指定的路径。