You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/_plugins/maven.md
+88-4Lines changed: 88 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -20,9 +20,9 @@ You can add `Group:Artifact:Version` coordinates in the `central.maven` file. Th
20
20
21
21
#### Release to Maven Central
22
22
23
-
Releasing to maven Central requires usually a couple of steps. For one you usually go through a staging repositroy like the staging nexus of sonartype. They perform a couple of checks and you manually have to clear the release via their web frontend.
23
+
Releasing to Maven Central requires usually a couple of steps. For one you usually go through a staging repository like the staging nexus of Sonatype. They perform a couple of checks and you manually have to clear the release via their web frontend.
24
24
25
-
In case you version your bundles individually, e.g. sonartype will not complain if a Version of one Artifact in your staging repo already exists. The release will simply not work. Thus you can define a staging repository. The Release process will check against the releaseUrl if something already exists, but will upload to the staging URL.
25
+
In case you version your bundles individually, e.g. Sonatype will not complain if a Version of one Artifact in your staging repo already exists. The release will simply not work. Thus you can define a staging repository. The Release process will check against the releaseUrl if something already exists, but will upload to the staging URL.
26
26
27
27
A configuration can look like this:
28
28
@@ -33,6 +33,89 @@ A configuration can look like this:
33
33
index=${.}/release.maven; \
34
34
name="Release"
35
35
36
+
#### Release to Maven Central via Sonatype Central Portal
37
+
38
+
Maven Central now offers publishing through the [Sonatype Central Portal](https://central.sonatype.com/), which provides a streamlined publishing process. The MavenBndRepository plugin supports this with the `sonatypeMode` configuration property.
39
+
40
+
The `sonatypeMode` property controls how artifacts are published to Maven Central through the Sonatype Central Portal API:
41
+
42
+
***`none`** (default) - Standard Maven repository behavior without special Sonatype Portal handling
43
+
***`manual`** - Artifacts are uploaded to Sonatype Central Portal for validation, but publishing must be done manually via the Sonatype web interface
44
+
***`autopublish`** - Artifacts are automatically published to Maven Central after successful upload and validation
45
+
46
+
##### Authentication
47
+
48
+
Publishing to Sonatype Central Portal requires authentication using a Bearer Token. Configure this in the [-connection-settings] instruction:
49
+
50
+
# Define your Bearer Token (typically from environment variable)
51
+
sonatype_bearer: '${env;SONATYPE_BEARER;}'
52
+
53
+
# Configure connection settings
54
+
-connection-settings.sonatype:\
55
+
server; id = https://central.sonatype.com/api/v1/publisher/upload;\
56
+
password = ${sonatype_bearer};\
57
+
verify = false
58
+
59
+
The Bearer Token can be obtained from your [Sonatype Central Portal account](https://central.sonatype.org/publish/generate-portal-token/).
60
+
61
+
##### Configuration Examples
62
+
63
+
**Example 1: Automatic Publishing**
64
+
65
+
This configuration automatically publishes artifacts to Maven Central after upload and validation:
66
+
67
+
sonatype_bearer: '${env;SONATYPE_BEARER;}'
68
+
69
+
-connection-settings.sonatype:\
70
+
server; id = https://central.sonatype.com/api/v1/publisher/upload;\
|`releaseUrl`|`URI`|| Comma separated list of URLs to the repositories of released artifacts.|
82
165
|`snapshotUrl`|`URI`|| Comma separated list of URLs to the repositories of snapshot artifacts.|
83
-
|`stagingUrl`|`URI`|| A single URL to the repositories staging repository. THis is required, e.g. for a release to maven central, which usually goes through a staging repository.|
166
+
|`stagingUrl`|`URI`|| A single URL to the repositories staging repository. This is required, e.g. for a release to maven central, which usually goes through a staging repository.|
167
+
|`sonatypeMode`|`none`\|`manual`\|`autopublish`|`none`| Controls how artifacts are published to Maven Central via the Sonatype Central Portal. `none`: standard Maven repository behavior; `manual`: upload for validation but requires manual publishing approval; `autopublish`: automatically publish after validation. Requires Bearer Token authentication via [-connection-settings]. |
84
168
|`local`|`PATH`|`~/.m2/repository`| The file path to the local Maven repository. |
85
169
|||| If specified, it should use forward slashes. If the directory does not exist, the plugin will attempt to create it.|
86
170
|||| The default can be overridden with the `maven.repo.local` System property.|
87
-
|`readOnly`| `true|false` |`false`| If set to _truthy_ then this repository is read only.|
171
+
|`readOnly`|`true`|`false`|`false`| If set to _truthy_ then this repository is read only.|
88
172
|`name`|`NAME`|`Maven`| The name of the repository.|
89
173
|`index`|`PATH`|`cnf/<name>.mvn`| The path to the _index_ file. The index file is a list of Maven _coordinates_.|
90
174
|`tags`|`STRING`|| Comma separated list of tags. (e.g. resolve, baseline, release) Use a placeholder like <<EMPTY>> to exclude the repo from resolution. The `resolve` tag is picked up by the [-runrepos](/instructions/runrepos.html) instruction.|
0 commit comments