Skip to content

Commit 596516a

Browse files
jDramaixcopybara-github
authored andcommitted
Change mavenconfiguration to publish artifacts on central.sonatype.org
PiperOrigin-RevId: 780922848
1 parent 44f21cd commit 596516a

File tree

2 files changed

+14
-13
lines changed

2 files changed

+14
-13
lines changed

maven/build_section.xml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
<classesDirectory>${project.artifactId}-classes</classesDirectory>
33
<javadocFile>${project.artifactId}-javadoc.jar</javadocFile>
44
<sourcesFile>${project.artifactId}-sources.jar</sourcesFile>
5-
<nexusUrl>https://oss.sonatype.org/</nexusUrl>
65
</properties>
76

87
<build>
@@ -66,13 +65,13 @@
6665
</executions>
6766
</plugin>
6867
<plugin>
69-
<groupId>org.sonatype.plugins</groupId>
70-
<artifactId>nexus-staging-maven-plugin</artifactId>
71-
<version>1.7.0</version>
68+
<groupId>org.sonatype.central</groupId>
69+
<artifactId>central-publishing-maven-plugin</artifactId>
70+
<version>0.8.0</version>
7271
<extensions>true</extensions>
7372
<configuration>
74-
<serverId>ossrh</serverId>
75-
<nexusUrl>${nexusUrl}</nexusUrl>
73+
<publishingServerId>central</publishingServerId>
74+
<autoPublish>${autoPublish}</autoPublish>
7675
</configuration>
7776
</plugin>
7877
</plugins>

maven/deploy.sh

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,14 @@
3434
# file in the ~/.m2/ directory and add this section :
3535
# <servers>
3636
# <server>
37-
# <id>sonatype-nexus-staging</id>
38-
# <username>...</username>
39-
# <password>...</password>
37+
# <id>central</id>
38+
# <username>central_portal_token_username</username>
39+
# <password>central_portal_token_password</password>
4040
# </server>
4141
# </servers>
4242
#
43+
# You can find the repository credentials in go/valentine
44+
#
4345
readonly BAZEL_ROOT=$(pwd)
4446
readonly BUILD_SECTION_FILE="${BAZEL_ROOT}/maven/build_section.xml"
4547

@@ -118,10 +120,10 @@ common::check_maven_prerequisites() {
118120
common::error "deploy_to_sonatype variable is missing."
119121
fi
120122

121-
# sonatype_auto_release is used to automatically release the artifacts after
123+
# sonatype_auto_publish is used to automatically publish the artifacts after
122124
# deployment.
123-
if [[ -z "${sonatype_auto_release:-}" ]]; then
124-
common::error "sonatype_auto_release variable is missing."
125+
if [[ -z "${sonatype_auto_publish:-}" ]]; then
126+
common::error "sonatype_auto_publish variable is missing."
125127
fi
126128

127129
if [[ -z ${MAVEN_GPG_PASSPHRASE:-} ]]; then
@@ -242,7 +244,7 @@ common::deploy_to_sonatype() {
242244
if [[ "${deploy_to_sonatype}" == true ]]; then
243245
common::info "Deploying artifacts to sonatype..."
244246
# Use maven to sign and deploy jar, sources jar and javadocs jar to OSS sonatype
245-
mvn -f "${pom_file}" clean deploy "-DautoReleaseAfterClose=${sonatype_auto_release}"
247+
mvn -f "${pom_file}" clean deploy "-DautoPublish=${sonatype_auto_publish}"
246248

247249
common::info "Deployment completed."
248250
else

0 commit comments

Comments
 (0)