maven-jar-plugin不包含.gitignore文件 [英] maven-jar-plugin does not include .gitignore file
问题描述
我尝试使用maven将应用程序打包到jar文件中.不知何故,除了.gitignore
文件之外的所有文件都添加到了jar中.
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?
即使我尝试像在include下方那样包含它,也将被忽略并且jar文件保持为空.
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版本:3.1.0
- maven版本:3.5.2
推荐答案
我尝试使用src/main/resources/.gitignore
进行此操作,并且它与默认的maven-jar-plugin:2.4
一起使用,即.gitignore
被打包到JAR中.
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.
然后,我使用了您提到的maven-jar-plugin:3.1.0
,但正如您所描述的那样,它无效有效.
Then I used the maven-jar-plugin:3.1.0
you mention and it did not work, as you describe.
事实证明,从v2.5开始,该功能不起作用.
It turned out that it doesn't work from v2.5 onwards.
这篇关于maven-jar-plugin不包含.gitignore文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!