Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion fern/products/sdks/deep-dives/self-hosted.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 14 additions & 0 deletions fern/products/sdks/generators/java/configuration.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -214,3 +214,17 @@ Provides a description of the SDK package that will appear in package metadata a
<ParamField path="reference-url" type="string" required={false} toc={true}>
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.
</ParamField>

## 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.
Loading