#First Time publishing on Maven Central

1 messages · Page 1 of 1 (latest)

woven rune
#

Hi ! I'm preparing to publish my first open-source Java project, a library (mini framework) to Maven Central using a multi-module Maven repository.

I'd appreciate your advice on a few questions:
0. GitHub: So far it's just a personal project, do I have to link Maven Central to my github?

  1. GroupId: I think to name itcom.mynickname is that valid ? or should I have or use a domain?
  2. Modules: Should all modules share the same version? Should I publish the parent POM or make a BOM ?
  3. Releases: What's the simplest way to manage publishing, versioning, and releases?
    Anything I should decide before my first release?

Thanks for your help!

fathom iceBOT
#

<@&987246964494204979> please have a look, thanks.

#

Here is an AI assisted attempt to answer your question 🤖. Maybe it helps! In any case, a human is on the way 👍. To continue talking to the AI, you can use </chatgpt:1108714622413963314>.

#
TJ-Bot
Hi ! I'm preparing to publish my first open-source Java project, a library (mini framework) to *Maven Central* using a multi-module Maven repository. I'd appreciate your advice on a few questions: 0. **GitHub:** So far it's just a personal project, do I h

Publishing your first multi-module Java project to Maven Central can be straightforward but involves key steps:

  1. Setup your POMs:

    • Ensure each module has a unique artifactId.
    • Use a parent POM to manage common configurations (groupId, version, plugin versions).
    • Define SCM, license, developers, and distributionManagement sections as required by Maven Central.
  2. Signing Artifacts:
    Use GPG to sign artifacts; Maven Central requires signed releases.

  3. Deploying:
    You need to create an OSSRH (OSS Repository Hosting) account via Sonatype and request permission for your groupId. The distributionManagement section must point to Sonatype's OSSRH repositories.

  4. Releasing Process:
    Use the Maven release plugin or manually deploy SNAPSHOTs for testing, then do a release.

  5. Multi-module specifics:

    • Deploy modules in order or use reactor builds (Maven handles multi-module builds).
    • Verify that each submodule has correct metadata.
  6. Central sync timing:
    After deployment, it typically takes a few hours for Sonatype to sync with Maven Central.


Useful links:

If you have specific parts of your multi-module setup or POM files to review, feel free to share!

placid magnet
woven rune
placid magnet
#

You can also just publish it through GitHub only and forget about Maven Central

#

There are ways to use a GitHub repo as a dependency in your build files, just requires bit more set-up for the developer using your library

woven rune
#

nah i don't want that

#

this library must be available like any other one, so people can add it easily

placid magnet
#

My old swing libraries were not on maven central either. A set-up would look like this then:```
repositories {
mavenCentral()
maven {
url = uri("https://maven.pkg.github.com/MrMystery10-del/SwingPlus")
credentials {
username = System.getenv("GITHUB_USERNAME")
password = System.getenv("GITHUB_TOKEN")
}
}
}

dependencies {
implementation("com.swingplus:swingplus:0.0.1")
}

#

But well

#

if you really want Maven Central

#

then buy a domain, I dont think there are any workarounds other than burrowing someone elses domain

placid magnet
#

I can let you use my domain if you really want that

woven rune
#

i actually dnt want to buy a domain

placid magnet
#

But only if you figure out to have it a one-time publish so you wont have the ability to publish as many stuff as you want without my consent for every individual package using my domain

#

I did bit of research. You can use github as a domain like this too:

<groupId>io.github.somedeveloper</groupId>
<artifactId>my-library</artifactId>
<version>1.0.0</version>
#

so u wont need a domain or burrow one

woven rune
#

OH BOY

#

are you sure about that?!

#

sounds grea!t

#

but how ?

placid magnet
#

I mean a real domain would be just 3 bucks and a bit nicer

woven rune
#

hold up please, i don't find that anywhere

#

how to configure github to maven central ?

placid magnet
#

You create a GitHub deployment

#

Though I can't give you a detailed guide right now, since it's quite a long time since I did that. And as mentioned I did two of those approaches, not this one that should technically work too

woven rune
#

well im searching, you're right about it, it's valid but i can't find a clear guide

woven rune
#

not with github

placid magnet
#

wdym

woven rune
#

it's not with GitHub

placid magnet
#

Its GitHub

#

Sonartype is what you use to publish, the repository lives in GitHub and the GitHub domain is used

woven rune
#

oh I see

placid magnet
#

GitHub isn't directly magically connected to Sonatype without adding fancy GitHub actions

woven rune
#

i didn't know about Sonatype in the past tbf

#

i thought that's platform to purchase domains

placid magnet
#

Sonatype is the one who operates the maven central

#

mvnrepository is just a website to index libraries made by a single random dude

#

I remember we even once had a conversation about this random dude in this community

woven rune
#

thanks for your help