DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Related

  • Runtime Formula Evaluation With MVEL Library in Spring Boot
  • C/C++ Is Where Vulnerability Programs Go to Guess
  • Building a Java 17-Compatible TLD Generator for Legacy JSP Tag Libraries
  • Extracting Clean Excel Tables From PDFs Using Python + Docling

Trending

  • Moving Beyond MediatR
  • Real-Time Risk Signals for AI Agent Authorization
  • Rethinking Java Design Patterns: From OOP to FP
  • How to Build Living AI Coding Assistants With Quarkus Agent MCP

How to Use Snapshot of Library in Maven Project

We could not keep waiting for the next release of the Sonatype library to happen, so we learned a workaround for that.

By 
Yamini Bansal user avatar
Yamini Bansal
·
Aug. 18, 20 · Tutorial
Likes (2)
Comment
Save
Tweet
Share
6.0K Views

Join the DZone community and get the full member experience.

Join For Free

So, for today I bring you a real-time problem which I and my teammates faced. One of my teammates contributed to an open-source library, Scanamo, and the contribution which was being made was very crucial for the next release of our project. We could not keep waiting for the next release of the library to happen, so we learned a workaround for that. That is, using a snapshot of a library dependency. Fortunately, the library I'm are talking about, releases its snapshot version after small updates to the code. So, let's find out what was the workaround I learned,

1. Adding OSS Sonatype Repository To Maven Project To Use Snapshot of the Library

Firstly, we need to enable our project to look for a snapshot version of a library that we want to add to our project. To do that, add below snippet to pom.xml

Java
 




x
10


 
1
<repositories>    
2
    <repository>
3
        <id>oss-sonatype</id>
4
        <name>oss-sonatype</name>
5
        <url> https://oss.sonatype.org/content/repositories/snapshots/ </url>
6
        <snapshots>
7
            <enabled>true</enabled>
8
        </snapshots>
9
    </repository>
10
 </repositories>



This way, we have provided a repository to our project to look for library snapshot with the mentioned version.

2. Now, Just Add the Dependency With Relevant Snapshot Version

You can search for it here.

Java
 




xxxxxxxxxx
1


 
1
<dependency>
2
<groupId>org.scanamo</groupId>
3
<artifactId> scanamo-alpakka_2.12 </artifactId>
4
<version>1.0.0-M10+18-8387f9ae-SNAPSHOT/</version>
5
</dependency>



Ah...Voila, now just refresh/rebuild your project and you will find the snapshot in the external libraries.

Library Snapshot (computer storage)

Opinions expressed by DZone contributors are their own.

Related

  • Runtime Formula Evaluation With MVEL Library in Spring Boot
  • C/C++ Is Where Vulnerability Programs Go to Guess
  • Building a Java 17-Compatible TLD Generator for Legacy JSP Tag Libraries
  • Extracting Clean Excel Tables From PDFs Using Python + Docling

Partner Resources

×

Comments

The likes didn't load as expected. Please refresh the page and try again.

  • RSS
  • X
  • Facebook

ABOUT US

  • About DZone
  • Support and feedback
  • Community research

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 215
  • Nashville, TN 37211
  • [email protected]

Let's be friends:

  • RSS
  • X
  • Facebook