new File(fixtureDir, 'gradle.properties').text = """systemProp.http.proxyHost=proxy.example
systemProp.http.proxyPort=8080
systemProp.https.proxyHost=proxy.example
systemProp.https.proxyPort=8080
"""

def result = GradleRunner.create()
    .withProjectDir(fixtureDir)
    .withArguments('assemble')
    .build()

Use the existing fixture directory selected by withProjectDir, alongside its build/settings files. Merge proxy properties with anything the fixture already needs; proxy hosts and ports stay separate. For permitted public repository downloads, the HTTP proxy list supplies candidates for those fixture properties.

The plugin's outer build can succeed while this functional-test build fails. Importing its test class does not copy the outer gradle.properties, and properties on the JUnit JVM do not by themselves describe the separate build's inputs.

TestKit uses an isolated Gradle user home by default, so the developer's usual private properties may be absent. Conversely, command-line -D or user-home properties can override the fixture's entries.

This configures Gradle repository requests. A plugin launching another downloader or owning a private HTTP transport can need another route.

Related articles