通过添加<includes> / <include>或<excludes> / <exclude>指定要包含或排除的文件集模式列表,并在pom.xml中添加分类器。
注意: jar-plugin 必须在新的执行中定义,否则它将替换 jar-plugin 的默认使用,而不是添加第二个工件。分类器还需要创建多个工件。
<project> ... <build> <plugins> ... <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-jar-plugin</artifactId> <version>3.2.2</version> <executions> <execution> <phase>package</phase> <goals> <goal>jar</goal> </goals> <configuration> <classifier>client</classifier> <includes> <include>**/service/*</include> </includes> </configuration> </execution> </executions> </plugin> ... </plugins> </build> ... </project>