Skip to content

Commit 140b2cc

Browse files
authored
Make clarifying updates to Publishing to Maven Central page (SDKs) (#528)
1 parent c09eb86 commit 140b2cc

File tree

1 file changed

+30
-23
lines changed

1 file changed

+30
-23
lines changed

fern/products/sdks/overview/java/publishing-to-maven-central.mdx

Lines changed: 30 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -15,32 +15,37 @@ page, you'll have a versioned package published on Maven Central.
1515

1616
<Step title="Configure `output` location">
1717

18-
Next, change the output location in `generators.yml` from `local-file-system` (the default) to `maven` to indicate that Fern should publish your package directly to the Maven Central registry:
19-
20-
```yaml {6-7}
21-
groups:
22-
java-sdk:
23-
generators:
24-
- name: fernapi/fern-java-sdk
25-
version: <Markdown src="/snippets/version-number-java.mdx"/>
26-
output:
27-
location: maven
28-
29-
```
18+
Change the output location in `generators.yml` from `local-file-system` (the default) to `maven` to indicate that Fern should publish your package directly to the Maven Central registry.
19+
20+
Then, add `publish-to: central` to indicate that the publish target is the new Maven Central Portal (Sonatype). To publish to the legacy Nexus Repository, use `publish-to: ossrh`.
21+
22+
```yaml {6-9} title="generators.yml"
23+
groups:
24+
java-sdk:
25+
generators:
26+
- name: fernapi/fern-java-sdk
27+
version: <Markdown src="/snippets/version-number-java.mdx"/>
28+
output:
29+
location: maven
30+
config:
31+
publish-to: central
32+
```
3033
</Step>
3134
3235
<Step title="Add repository location">
3336
34-
Add the path to your GitHub repository to `generators.yml`:
37+
Add the path to your GitHub repository.
3538
36-
```yaml {8-9}
39+
```yaml {10-11} title="generators.yml"
3740
groups:
3841
java-sdk:
3942
generators:
4043
- name: fernapi/fern-java-sdk
4144
version: <Markdown src="/snippets/version-number-java.mdx"/>
4245
output:
4346
location: maven
47+
config:
48+
publish-to: central
4449
github:
4550
repository: your-org/company-java
4651
```
@@ -61,27 +66,25 @@ groups:
6166
<Step title="Verify your namespace">
6267
6368
1. Click on your username, then select **View Namespaces**. Click **Register New Namespace**.
64-
1. Enter your company website or GitHub account in reverse domain name format and go through the
65-
verification process.
69+
1. Enter your company website or GitHub account in reverse domain name format and go through the verification process.
6670
6771
</Step>
6872
<Step title="Configure Maven Coordinate">
6973
70-
Add the namespace you just verified in Maven Central to the `coordinate:
71-
groupId:artifactId` field. This specifies how your Java SDK will be
74+
Add the namespace you just verified in Maven Central to the `coordinate` field. This specifies how your Java SDK will be
7275
published and referenced in the Maven Central respository.
7376

74-
```yaml {8,11}
77+
```yaml {8} title="generators.yml"
7578
groups:
7679
java-sdk:
7780
generators:
7881
- name: fernapi/fern-java-sdk
7982
version: <Markdown src="/snippets/version-number-java.mdx"/>
8083
output:
8184
location: maven
82-
coordinate: com.company:sdk-name # <company name in reverse domain name format>:<SDK name>
85+
coordinate: com.company:sdk-name # groupId:artifactId
8386
config:
84-
publish-to: central # Use 'central' for new Sonatype Central Portal (most common)
87+
publish-to: central
8588
github:
8689
repository: your-org/company-java
8790
```
@@ -103,7 +106,7 @@ groups:
103106

104107
Add `username: ${MAVEN_USERNAME}` and `password: ${MAVEN_PASSWORD}` to `generators.yml` to tell Fern to use the `MAVEN_USERNAME` and `MAVEN_PASSWORD` environment variable for authentication when publishing to the Maven Central registry.
105108

106-
```yaml {9-10}
109+
```yaml {9-10} title="generators.yml"
107110
groups:
108111
java-sdk:
109112
generators:
@@ -114,6 +117,8 @@ groups:
114117
coordinate: com.company:sdk-name
115118
username: ${MAVEN_USERNAME}
116119
password: ${MAVEN_PASSWORD}
120+
config:
121+
publish-to: central
117122
github:
118123
repository: your-org/company-java
119124
```
@@ -157,7 +162,7 @@ Export your key so you can store it in an environment variable later on:
157162

158163
Add the `keyId`, `password`, and `secretKey` from the previous step to `generators.yml`:
159164

160-
```yaml {11-14}
165+
```yaml {11-14} title="generators.yml"
161166
groups:
162167
java-sdk:
163168
generators:
@@ -172,6 +177,8 @@ groups:
172177
keyId: ${MAVEN_SIGNATURE_SECRET_KEY_ID}
173178
password: ${MAVEN_SIGNATURE_PASSWORD}
174179
secretKey: ${MAVEN_SIGNATURE_SECRET_KEY}
180+
config:
181+
publish-to: central
175182
github:
176183
repository: your-org/company-java
177184
```

0 commit comments

Comments
 (0)