how-to-maven-central

Sample project for demonstrating deployment to Maven Central

License

License

Categories

Categories

Maven Build Tools
GroupId

GroupId

com.johnathangilday
ArtifactId

ArtifactId

how-to-maven-central
Last Version

Last Version

1.6
Release Date

Release Date

Type

Type

jar
Description

Description

how-to-maven-central
Sample project for demonstrating deployment to Maven Central
Project URL

Project URL

https://github.com/gilday/how-to-maven-central
Source Code Management

Source Code Management

https://github.com/gilday/how-to-maven-central

Download how-to-maven-central

How to add to project

<!-- https://jarcasting.com/artifacts/com.johnathangilday/how-to-maven-central/ -->
<dependency>
    <groupId>com.johnathangilday</groupId>
    <artifactId>how-to-maven-central</artifactId>
    <version>1.6</version>
</dependency>
// https://jarcasting.com/artifacts/com.johnathangilday/how-to-maven-central/
implementation 'com.johnathangilday:how-to-maven-central:1.6'
// https://jarcasting.com/artifacts/com.johnathangilday/how-to-maven-central/
implementation ("com.johnathangilday:how-to-maven-central:1.6")
'com.johnathangilday:how-to-maven-central:jar:1.6'
<dependency org="com.johnathangilday" name="how-to-maven-central" rev="1.6">
  <artifact name="how-to-maven-central" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.johnathangilday', module='how-to-maven-central', version='1.6')
)
libraryDependencies += "com.johnathangilday" % "how-to-maven-central" % "1.6"
[com.johnathangilday/how-to-maven-central "1.6"]

Dependencies

There are no dependencies for this project. It is a standalone project that does not depend on any other jars.

Project Modules

There are no modules declared in this project.

how-to-maven-central

Reference project for deploying a Maven project to Maven Central via Sonatype OSSRH.

Build Status

Deploying to Sonatype OSSRH is more complicated than just mvn deploy: it requires users to become familiar with the Sonatype Nexus Staging workflow and its associated tooling the nexus-staging-maven-plugin.

There are different ways to use the nexus-staging-maven-plugin. This example project demonstrates two different ways.

staging-deploy workflow

The nexus-staging-maven-plugin can perform the whole staging and release workflow as part of the Maven project's build. This is the simplest way to configure releases to Maven Central and should work for most OSS projects.

<plugin>
  <groupId>org.sonatype.plugins</groupId>
  <artifactId>nexus-staging-maven-plugin</artifactId>
  <version>1.6.8</version>
  <extensions>true</extensions>
  <configuration>
   <serverId>ossrh</serverId>
   <nexusUrl>https://oss.sonatype.org/</nexusUrl>
   <autoReleaseAfterClose>true</autoReleaseAfterClose>
  </configuration>
</plugin>

There are plenty of blog posts and guides on how to configure the nexus-staging-maven-plugin in this configuration. Tag v1.1 of this project was deployed using this configuration.

Manual Staging Bundle Creation and Deployment

Examples using the Manual Staging Bundle Creation and Deployment workflow are less common. In this workflow, users use scripts to manually create and deploy artifacts to the staging repository in OSSRH. The nexus-staging-maven-plugin is still involved, but instead of being integrated into a Maven build, this workflow calls for using the plugin's "rc" goals to manually open, close, release, list, and drop staging repositories. The deploy.sh shows an example of using these goals in a script.

Versions

Version
1.6
1.5
1.4
1.3
1.2
1.1
1.0