Search code examples
mavengitignoremaven-archetypemaven-resources-plugin

.gitignore file is not copied to archetype JAR - Workarounds?


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>

Solution

  • 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>