DEV Community

dzikoysk ✨
dzikoysk ✨

Posted on • Edited on

Publishing your artifacts to the Reposilite - a new self-hosted repository manager

Maven ecosystem is a part of every Java developer’s life. It doesn't matter if you use Maven or Gradle, Kotlin or Scala (etc.), artifacts are exchanged via the same protocol - Maven protocol ✨.

We can publish our public projects to the official Maven Central repository, but in case of the private ones, for such a long time we could only use:

These powerful projects are a great solution for large companies, but it does not really work well for hobbyist projects and environments focused on simplicity and reduced usage of resources due to limited budget.

It's why I've created Reposilite, lightweight and open source repository manager for Maven artifacts. It is a simple solution to replace managers like Nexus, Archiva or Artifactory.

Pros:

  • Efficient, reduce usage of your resources to even 10MB of RAM, instead of e.g. 2GB
  • Extremely easy to use
  • Approved and listed on Apache Site
  • Open source ❤️

Cons:

  • May have lack of extra features, but you can always request for them in the issues
  • Focused on performance, some of heavy features may not be implemented at all

Install

Note: Project changes dynamically, so the some part of this article, like screenshots, may get outdated.

At this moment (Reposilite 2.6.1) you can use standalone jar version of Reposilite or Docker Image 🐳. If you're looking for always up to date installation guide, visit:

We'll focus on standalone version in this article, which can be downloaded from GitHub Releases page:

To launch Reposilite, just run the jar archive:



$ java -Xmx16M -jar reposilite.jar


Enter fullscreen mode Exit fullscreen mode

Voilà, that's pretty much all, you've just become owner of a new Maven repository in less than 1 minute ฅ^•ﻌ•^ฅ You should be able to see the result on localhost:80:

Preview

That was quick, so let's do something else. Since 2.x version, instead of complicated permission based system between users and projects, Reposilite uses access token system to authorize requests. To fully understand access tokens, visit:

First of all, we need to tell Maven, where we want to upload our project. For this purpose, you should declare distribution management property in your pom.xml:



<distributionManagement>
    <repository>
        <id>local-repository</id>
        <url>http://localhost:80/releases</url>
    </repository>
</distributionManagement>


Enter fullscreen mode Exit fullscreen mode

To generate access token for administrator, we need to use keygen command in Reposilite CLI:



$ keygen / admin
| Generated new access token for admin(/)
| AW7-kaXSSXTRVL_Ip9v7ruIiqe56gh96o1XdSrqZCyTX2vUsrZU3roVOfF-YYF-y
| Stored tokens: 1


Enter fullscreen mode Exit fullscreen mode

The / separator means, that requests signed by this token may access all the paths, e.g:

Request URI Status
/ Authorized
/releases Authorized
/snapshots Authorized
/releases/our/awesome/project Authorized

Now, you have to add a new server entry with generated token to your ~/.m2/settings.xml file:



<server>
  <!-- The id just has to match the id provided in pom.xml -->
  <id>local-repository</id>
  <username>admin</username>
  <password>AW7-kaXSSXTRVL_Ip9v7ruIiqe56gh96o1XdSrqZCyTX2vUsrZU3roVOfF-YYF-y</password>
</server>


Enter fullscreen mode Exit fullscreen mode

To publish your artifact, just run:



$ mvn deploy


Enter fullscreen mode Exit fullscreen mode

If you configured everything properly, you should be able to see a new version of your artifact in the repository browser! 🎉

To discover more functionalities of Reposilite, like a dashboard or remote CLI:

CLI Preview

Visit the Reposilite - Guide and GitHub - Reposilite.

Good luck and happy deploying 🚀,
dzikoysk

Top comments (5)

Collapse
 
imtiazrahi profile image
Imtiaz Rahi • Edited

I have setup reposilite following the docker guide.
But how to access the CLI. Clicking on leaf icon takes me authentication page.
How to setup token without using the CLI ?
Upload error

Collapse
 
imtiazrahi profile image
Imtiaz Rahi

from upload webUI, getting this error screen.
why I have to login again. I got into that dashboard using username and token already.
can you please help.

Collapse
 
dzikoysk profile image
dzikoysk ✨

@imtiazrahi Hey, just report the issue on GitHub :) I'm not really looking at dev.to so often, and I don't think it is a proper place to continue such a conversation.

Collapse
 
jofrantoba profile image
jofrantoba

Aún no funciona los comandos en la consola web???

Collapse
 
dzikoysk profile image
dzikoysk ✨

CLI on Chrome has been fixed in GH-178 :)