processTestResources and default excludes

Hi all. I need to keep the “.git” folders in the test resources because I’m actually testing git operations against a local repository. Gradle, though, is ignoring them, problably because of the global excludes. I know how to make this work using maven, but I’m new to Gradle and need some guidance. How would I do this? I would like to do something similar of the snippet below:

			<executions>
				<execution>
					<id>additional-resources</id>
					<phase>process-test-resources</phase>
					<goals>
						<goal>copy-resources</goal>
					</goals>
					<configuration>
						<outputDirectory>${project.build.testOutputDirectory}</outputDirectory>
						<resources>
							<resource>
								<directory>${project.basedir}/src/test/resources</directory>
							</resource>
						</resources>
						<addDefaultExcludes>false</addDefaultExcludes>
					</configuration>
				</execution>
			</executions>

Yes, you are running into the global default excludes, but there is not an equivalent of <addDefaultExcludes>false</addDefaultExcludes> that can be set directly in Gradle currently. This is documented currently as Issue 1348 on GitHub.

Instead you need to disable it directly on the underlying DirectoryScanner from Ant. At least a few with this issue have worked around it using the code provided in the first comment on the original JIRA issue: GRADLE-1183.

1 Like

Yes, suggested code worked, thanks. I put it under the task processTestResources.