Does anybody know how can I make resources like .gitignore be part of the resulting project ?
- create archetype with archetype-resources/.gitignore
- mvn install
- mvn archatype:generate
- resulting project doesn't contain .gitignore
PS. I'm sure it isn't there.
Check your maven-resources-plugin version by launching the Maven build on debug (with -X option). If you use 2.7, there is a regression where .gitignore files are silently ignored.
In this case, you will have to explicitly use 2.6 in your pom.xml:
Add a
fileSet
entry tosrc/main/resources/META-INF/maven/archetype-metadata.xml
with an empty directory tag:This will copy the included files from
src/main/resources/archetype-resources
to the project root directory.the bug is still in the newest maven-archetype-plugin 2.4 and maven-resources-plugin 3.0.1.
here is the solution:
and in your generate pom.xml you should add
Alternative for downgrading
maven-resources-plugin
is to enforceplexus-utils
version which actually has a regression:The bug seems to be still present in the maven-archetype-plugin v3.0.1 . For those who do not want to downgrade the maven-resource-plugin. I managed to establish a more or less ugly workaround.
First you rename the archetype-resources/.gitignore to
then inside the
archetype-metadata.xml
addWhen the archetype is generated maven will now first copy the
__gitignore__
then sees the__[file]__
syntax and will replace it with the default value ".gitignore"This solution for upcoming maven-resources-plugin v3.0.0 (not yet released at the time of posting this; current is still 2.7) from https://issues.apache.org/jira/browse/MRESOURCES-190 seems better than holding back version upgrades: