Apache

Docs Plugins

JAR Plugin 3.5.1 · Other versions

Builds a Java Archive (JAR) file from the compiled project classes and resources.

Source
Edit this page
Wrong?
Report a problem

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.5.1</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.