mavengitignoremaven-jar-plugin

maven-jar-plugin does not include .gitignore file


I try to package an application into a jar file with maven. Somehow all files except .gitignore files are added to the jar.

Why is this file skipped and how can I disable this?

Even if I try to include it like below the include is ignored and the jar file remains empty.

<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-jar-plugin</artifactId>
  <configuration>
    <includes>
      <include>**/.gitignore</include>
    </includes>
  </configuration>
</plugin>

Solution

  • I tried this with a src/main/resources/.gitignore and it worked with the default maven-jar-plugin:2.4, i.e. .gitignore was packaged into the JAR.

    Then I used the maven-jar-plugin:3.1.0 you mention and it did not work, as you describe.

    It turned out that it doesn't work from v2.5 onwards.

    UPDATE

    Resolved with [MJAR-296] No way to suppress default excludes in maven-jar-plugin.