Skip to content

Commit 7b982de

Browse files
authored
feat: document Maven Central mirror settings (#608)
1 parent 0831b82 commit 7b982de

File tree

3 files changed

+45
-6
lines changed

3 files changed

+45
-6
lines changed

src/content/docs/paper/admin/reference/system-properties.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,9 +244,35 @@ It also remaps plugin CB calls to remove the version information.
244244
- **default**: `false`
245245
- **description**: Setting this to true indicates that you have agreed with [Mojang's EULA](https://aka.ms/MinecraftEULA), skipping `eula.txt` checks.
246246

247+
#### org.bukkit.plugin.java.LibraryLoader.centralURL
248+
249+
- **default**: `https://maven-central.storage-download.googleapis.com/maven2`
250+
- **description**: Sets the default central repository URL, from which plugins' dependencies declared using the [`libraries`](/paper/dev/plugin-yml#libraries) plugin.yml field are resolved. This is overridden by the [`PAPER_DEFAULT_CENTRAL_REPOSITORY`](#paper_default_central_repository) environment variable, if it is set.
251+
252+
:::caution
253+
254+
If you wish to configure this with Maven Central, use a mirror, as using Maven Central directly as a CDN is against the Maven Central Terms of Service, and you may hit rate limits.
255+
256+
By default, this uses Google's NA mirror of Maven Central. You may also use region-specific mirrors listed [here](https://storage-download.googleapis.com/maven-central/index.html).
257+
258+
:::
259+
247260
## List of environment variables
248261

249262
#### PAPER_VELOCITY_SECRET
250263

251264
- **default**: `unset`
252265
- **description**: Overrides the [`proxies.velocity.secret`](/paper/reference/global-configuration#proxies_velocity_secret) global configuration option.
266+
267+
#### PAPER_DEFAULT_CENTRAL_REPOSITORY
268+
269+
- **default**: `https://maven-central.storage-download.googleapis.com/maven2`
270+
- **description**: Sets the default central repository URL, from which plugins' dependencies declared using the [`libraries`](/paper/dev/plugin-yml#libraries) plugin.yml field are resolved. This overrides the [`org.bukkit.plugin.java.LibraryLoader.centralURL`](#orgbukkitpluginjavalibraryloadercentralurl) system property, if it is set.
271+
272+
:::caution
273+
274+
If you wish to configure this with Maven Central, use a mirror, as using Maven Central directly as a CDN is against the Maven Central Terms of Service, and you may hit rate limits.
275+
276+
By default, this uses Google's NA mirror of Maven Central. You may also use region-specific mirrors listed [here](https://storage-download.googleapis.com/maven-central/index.html).
277+
278+
:::

src/content/docs/paper/dev/getting-started/paper-plugins.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,19 @@ Currently, you are able to add two different library types:
157157
[`JarLibrary`](jd:paper:io.papermc.paper.plugin.loader.library.impl.JarLibrary) and
158158
[`MavenLibraryResolver`](jd:paper:io.papermc.paper.plugin.loader.library.impl.MavenLibraryResolver).
159159

160+
:::danger
161+
162+
If you wish to resolve libraries from Maven Central, use a mirror, as using Maven Central directly as a CDN is against the Maven Central Terms of Service, and users of your plugin may hit rate limits.
163+
164+
You should use Paper's default mirror, configured by the [`PAPER_DEFAULT_CENTRAL_REPOSITORY`](/paper/reference/system-properties#paper_default_central_repository) environment variable and [`org.bukkit.plugin.java.LibraryLoader.centralURL`](/paper/reference/system-properties#orgbukkitpluginjavalibraryloadercentralurl) system property:
165+
```java
166+
resolver.addRepository(new RemoteRepository.Builder("central", "default", MavenLibraryResolver.MAVEN_CENTRAL_DEFAULT_MIRROR).build());
167+
```
168+
169+
Using the Maven Central repository (i.e. `*.maven.org` or `*.maven.apache.org`) will cause a warning to be shown in the console.
170+
171+
:::
172+
160173
## Differences
161174

162175
### Bukkit serialization system

src/content/docs/paper/dev/getting-started/plugin-yml.mdx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -114,12 +114,6 @@ The prefix of the plugin. This is what will be displayed in the log instead of t
114114

115115
### libraries
116116

117-
:::caution
118-
119-
The use of this feature is *currently* against Maven Central's TOS. However, this feature is very likely to stay.
120-
121-
:::
122-
123117
This is a list of libraries that your plugin depends on. These libraries will be downloaded from the Maven Central repository and added to the classpath.
124118
This removes the need to shade and relocate the libraries.
125119

@@ -129,6 +123,12 @@ libraries:
129123
- com.google.code.gson:gson:2.8.6
130124
```
131125

126+
:::note
127+
128+
The central repository is configurable using the [`PAPER_DEFAULT_CENTRAL_REPOSITORY`](/paper/reference/system-properties#paper_default_central_repository) environment variable and [`org.bukkit.plugin.java.LibraryLoader.centralURL`](/paper/reference/system-properties#orgbukkitpluginjavalibraryloadercentralurl) system property.
129+
130+
:::
131+
132132
### permissions
133133

134134
This is a list of permissions that your plugin uses. This is useful for plugins that use permissions to restrict access to certain features.

0 commit comments

Comments
 (0)