Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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>
  • maven-jar-plugin version: 3.1.0
  • maven version: 3.5.2
like image 526
ochs.tobi Avatar asked Mar 04 '23 05:03

ochs.tobi


1 Answers

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.

like image 108
Gerold Broser Avatar answered Mar 12 '23 13:03

Gerold Broser