How to include/exclude content from jar artifact

Specify a list of fileset patterns to be included or excluded by adding <includes>/<include> or <excludes>/<exclude> in your pom.xml.

<project>
  ...
  <build>
    <plugins>
      ...
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-jar-plugin</artifactId>
        <version>3.4.2</version>
        <configuration>
          <includes>
            <include>**/service/*</include>
          </includes>
        </configuration>
      </plugin>
      ...
    </plugins>
  </build>
  ...
</project>

Note that the patterns need to be relative to the path specified for the plugin's classesDirectory parameter.