Currently in the maven-resources-plugin there is a bug that the .gitignore file is not copied to the archetype JAR. See this bug report
Short and simple question: are there workarounds for getting the file in the archetype?
Edit: setting the maven-resources-plugin version to 2.6 doesn't solve my problem (like mentioned here)
<build> <pluginManagement> <plugins> <plugin> <artifactId>maven-resources-plugin</artifactId> <version>2.6</version> </plugin> </plugins> </pluginManagement> </build>
The bug is now fixed in the maven-resources-plugin.
To include the .gitignore file, the maven-resources-plugin plugin should be set explicitly in the archetype pom.xml
file with the configuration value addDefaultExcludes
set to false
:
<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-resources-plugin</artifactId> <version>3.0.2</version> <configuration> <addDefaultExcludes>false</addDefaultExcludes> </configuration> </plugin>
As @amanteaux says, adding addDefaultExcludes
with false
ensures that the maven-resources-plugin copies the .gitignore
file to target/classes
, however, maven-jar-plugin (> 2.4) won't copy .gitignore
to the resulting jar. See this stackoverflow comment for more information. So one workaround would be, in addition to the flag above for maven-resources-plugin, rollback maven-jar-plugin to 2.4.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With