Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Mission accomplished - Deploy to Maven Central

ElmarDott
November 28, 2021

Mission accomplished - Deploy to Maven Central

Many developers have ideas they work on it in their spare time. The most of us are convinced about open source and share their own projects on platforms like GitHub. But what happen after a publication of the source code? If you really want to gain people to use your project you’re not done yet. It’s also a good idea to publish your artifacts for a simple usage.

The most famous storage for binary Java Artifacts is Maven Central. Doesn‘t matter if you use in your projects Ivy, Gradle or Maven as dependency management, all those technologies access to Maven Central. In this talk you will learn how to publish your artifacts with Maven to Sonatype Nexuss OSS. We pass through all steps from creating accounts until the the binaries are available. In between I give some general hints about the usage of repository managers and helpful tricks for a lightweight Release Management.

--------------------------------------------------------------------------------------------------
Homepage : https://elmar-dott.com
AnchorFM : https://anchor.fm/elmar-dott
Twitter - https://twitter.com/ElmarDott
GitHub - https://github.com/ElmarDott
Lbry - https://lbry.tv/@elmar.dott:8
BitChute - https://www.bitchute.com/channel/3IyCzKdX8IpO/
--------------------------------------------------------------------------------------------------

ElmarDott

November 28, 2021
Tweet

More Decks by ElmarDott

Other Decks in Programming

Transcript

  1. Jc
    on
    f 2021
    P
    e
    r
    u
    on
    l
    i
    n
    e
    © 2021 ElmarDott
    Mission accomplished -
    Deploy to Maven Central

    View Slide

  2. © 2021
    j
    Con
    f P
    e
    r
    u 2021
    Sp
    e
    a
    k
    e
    r
    El
    ma
    r Do
    t
    t
    (M. Schulz) studied at HS Merseburg, Germany, computer science and
    holds an engineers degree in software engineering. He tweets regularly
    about several technical topics. The main topics in his field of work are Build
    and Configuration Management, Software Architecture and Release
    Management.
    About more than 15 years he is working in different large Web Application
    projects all over the world. He is an independent consultant / trainer. To
    share his knowledge he gives talks on conferences, if he is not writing on a
    new article about software engineering. https://elmar-dott.com
    + Consultant + Writer + Speaker + Trainer +

    View Slide

  3. © 2021
    j
    Con
    f P
    e
    r
    u 2021
    Ag
    e
    nd
    a
    What is a Repository Manager?
    Sonatype Nexus OSS
    Publishing Sources and Artifacts
    How to prepare your project.
    Register your repository
    Uploads & Artifact validation

    View Slide

  4. © 2021
    j
    Con
    f P
    e
    r
    u 2021
    De
    p
    e
    nd
    e
    n
    c
    y Man
    a
    g
    e
    m
    e
    n
    t
    Bower
    JavaScript DockerHub Java .NET
    Each platform & also almost each build tool have an own dependency management to
    deal with artifacts.

    View Slide

  5. © 2021
    j
    Con
    f P
    e
    r
    u 2021
    Re
    p
    o
    s
    i
    t
    o
    r
    y Man
    a
    g
    e
    r

    build tools, dependency management, packet manager &
    repository manager

    essential part of the build / CI-CD infrastructure

    speed up the build & deploy pipeline

    storage and archive binary artifacts

    deal with multiple formats

    two major providers JFrog Artifactory & Sonatype Nexus
    OSS

    View Slide

  6. © 2021
    j
    Con
    f P
    e
    r
    u 2021
    Son
    a
    t
    y
    p
    e N
    e
    x
    u
    s OSS

    View Slide

  7. © 2021
    j
    Con
    f P
    e
    r
    u 2021
    Ma
    v
    e
    n D
    e
    p
    l
    o
    y
    m
    e
    n
    t
    local repository remote repository
    mvn install mvn deploy


    nexus-oss
    http://localhost:8082/repository/maven-public/


    POM – consume a repository POM – deploy artifacts


    nexus-oss
    ${release.repo}


    nexus-oss
    ${snapshot.repro}


    webdav
    Local deployed site
    ${site.repro}


    SETTINGS - credentials
    POM – consume a repository


    nexus-oss
    mvn-deployer
    #myS3cr3t#


    View Slide

  8. © 2021
    j
    Con
    f P
    e
    r
    u 2021
    Fr
    om G
    i
    tHu
    b 2 MVN C
    e
    n
    t
    ra
    l
    project-1.0.0.jar
    sources-1.0.0.jar
    javadoc-1.0.0.jar
    Maven central
    publish code
    build artifacts
    publish artifacts

    View Slide

  9. © 2021
    j
    Con
    f P
    e
    r
    u 2021
    Ma
    v
    e
    n Pl
    u
    g
    i
    n
    s

    org.apache.maven.plugins
    maven-jar|war|ear-plugin
    3.2.0


    org.apache.maven.plugins
    maven-gpg-plugin
    1.6


    sign-artifacts
    verify

    sign




    myKey
    mySecret



    org.apache.maven.plugins
    maven-javadoc-plugin
    3.3.0


    attach-javadocs

    jar





    org.apache.maven.plugins
    maven-source-plugin
    3.2.1


    package

    jar-no-fork
    test-jar-no-fork




    View Slide

  10. © 2021
    j
    Con
    f P
    e
    r
    u 2021
    Re
    g
    i
    s
    t
    e
    r a
    t Son
    a
    t
    y
    p
    e J
    i
    ra

    View Slide

  11. © 2021
    j
    Con
    f P
    e
    r
    u 2021
    Pr
    e
    p
    a
    r
    e y
    ou
    r POM
    sample pom
    Sample project pom fpr publisching on Maven Central.
    2021
    https://elmar-dott.com
    io.github.myProject
    project
    1.0.0
    jar

    scm:git:https://github.com/ElmarDott/TP-CM.git
    scm:git:https://github.com/ElmarDott/TP-CM.git
    scm:git:https://github.com/ElmarDott/TP-CM.git



    Elmar Dott
    [email protected]




    Apache License 2.0
    https://www.apache.org/licenses/LICENSE-2.0


    View Slide

  12. © 2021
    j
    Con
    f P
    e
    r
    u 2021
    S
    i
    g
    n
    i
    ng y
    ou
    r Ar
    t
    i
    f
    a
    c
    t
    s

    View Slide

  13. © 2021
    j
    Con
    f P
    e
    r
    u 2021
    OSS Son
    a
    t
    y
    p
    e Ar
    t
    i
    f
    a
    c
    t u
    p
    l
    o
    ad

    View Slide

  14. © 2021
    Jc
    on 2021 : Ro
    l
    i
    ng St
    on
    e
    s
    Re
    f
    e
    r
    e
    n
    z
    e
    n
    [1] Marco Schulz, 2021, Continuous Integration mit Jenkins,
    Rheinwerk, ISBN: ISBN 978-3-8362-7834-8
    https://www.rheinwerk-verlag.de/continuous-integration-mit-jenki
    ns/
    [2] https://www.sonatype.com/products/repository-oss/
    [3] https://search.maven.org
    [4] https://issues.sonatype.org/login.jsp
    [5] https://oss.sonatype.org
    [6] https://central.sonatype.org/publish/requirements/gpg/
    [7] https://central.sonatype.org/publish/publish-guide/

    View Slide

  15. © 2021
    j
    Con
    f P
    e
    r
    u 2021
    Cr
    e
    d
    e
    n
    t
    i
    a
    l
    s
    ---------------------------------------------------------
    Homepage : https://elmar-dott.com
    GitHub : https://github.com/ElmarDott
    AnchorFM : https://anchor.fm/elmar-dott
    Twitter : https://twitter.com/ElmarDott
    Speaker Deck : https://speakerdeck.com/elmardott
    Lbry : https://lbry.tv/@elmar.dott:8
    BitChute : https://www.bitchute.com/channel/3IyCzKdX8IpO/
    ---------------------------------------------------------
    Danke / thank you / Gracias

    View Slide

  16. View Slide