diff --git a/fern/products/sdks/deep-dives/self-hosted.mdx b/fern/products/sdks/deep-dives/self-hosted.mdx index b9d8b7ef0..4f29d5268 100644 --- a/fern/products/sdks/deep-dives/self-hosted.mdx +++ b/fern/products/sdks/deep-dives/self-hosted.mdx @@ -219,7 +219,7 @@ The self-hosted process works as follows: 1. **Generate SDK** (local) - The CLI runs the generator container locally to produce SDK files based on your API definition and `generators.yml` configuration 1. **Output SDK** (local) - Generated SDK files are saved to your configured output location (local file system or GitHub repository) -Steps 1 and 2 are the only network calls made when using the `--local` flag. No API definition or specification data is sent over the network: all SDK generation happens locally on your machine. +Steps 1 and 2 are the only network calls the CLI makes when using the `--local` flag. No API definition or specification data is sent over the network: all SDK generation happens locally on your machine. The Java generator additionally reaches Gradle's distribution and plugin hosts to format its output, which [`FERN_JAVA_SKIP_FORMATTING`](/learn/sdks/generators/java/configuration#skip-code-formatting) turns off. ```mermaid sequenceDiagram diff --git a/fern/products/sdks/generators/java/configuration.mdx b/fern/products/sdks/generators/java/configuration.mdx index 2486668a9..cb48ef79b 100644 --- a/fern/products/sdks/generators/java/configuration.mdx +++ b/fern/products/sdks/generators/java/configuration.mdx @@ -214,3 +214,17 @@ Provides a description of the SDK package that will appear in package metadata a Sets the reference URL (typically the API documentation or project website) that will be included in the package metadata for users to find additional information. + +## Skip code formatting + +After writing the SDK files, the Java generator runs `./gradlew :spotlessApply` to format them. That command downloads the Gradle distribution from `services.gradle.org` and resolves the Spotless formatting plugin from `plugins.gradle.org` and Maven Central, which fails on networks that block those hosts. + +Set the `FERN_JAVA_SKIP_FORMATTING` environment variable to a truthy value (`1`, `true`, `yes`, or `on`, in any casing) to skip the formatting pass. Generation then makes no Gradle invocation at all, which also shortens generation time: + +```bash +FERN_JAVA_SKIP_FORMATTING=true fern generate --group java-sdk +``` + +The Fern CLI forwards the variable from your shell into the generator container, so it covers local generation as well; passing `docker run -e FERN_JAVA_SKIP_FORMATTING=true` works when invoking the generator image directly. The variable requires Java SDK generator 4.18.0 or later and is unset by default. + +Skipping the pass emits the generated code unformatted. The Spotless plugin stays wired into the generated `build.gradle`, so running `./gradlew spotlessApply` in the SDK repository formats the code later.