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

Zones

Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

Last call! Secure your stack and shape the future! Help dev teams across the globe navigate their software supply chain security challenges.

Modernize your data layer. Learn how to design cloud-native database architectures to meet the evolving demands of AI and GenAI workloads.

Releasing software shouldn't be stressful or risky. Learn how to leverage progressive delivery techniques to ensure safer deployments.

Avoid machine learning mistakes and boost model performance! Discover key ML patterns, anti-patterns, data strategies, and more.

Related

  • Private Remote Maven Repository With Artipie
  • How to Publish Artifacts to Maven Central
  • Redefining Artifact Storage: Preparing for Tomorrow's Binary Management Needs
  • Stop Using Spring Profiles Per Environment

Trending

  • Automating Data Pipelines: Generating PySpark and SQL Jobs With LLMs in Cloudera
  • The Role of Functional Programming in Modern Software Development
  • AI-Based Threat Detection in Cloud Security
  • A Guide to Container Runtimes
  1. DZone
  2. Data Engineering
  3. Databases
  4. Host Your Maven Artifacts Using Azure Blob Storage

Host Your Maven Artifacts Using Azure Blob Storage

Want to use Azure Blob Storage to host your Maven artifacts? Here's a simple guide to bringing your Java projects to the cloud for ease of accessibility.

By 
Emmanouil Gkatziouras user avatar
Emmanouil Gkatziouras
DZone Core CORE ·
Updated Apr. 10, 18 · Tutorial
Likes (4)
Comment
Save
Tweet
Share
17.6K Views

Join the DZone community and get the full member experience.

Join For Free

If you use Microsoft Azure and you use Java for your projects, then Azure Blob Storage is a great place to host your team's artifacts.

It is easy to set up and pretty cheap. Also, it is much simpler than setting one of the existing repository options (JFrog, Nexus, Archiva, etc.) if you are not particularly interested in their features.

To get started, you need to specify a Maven wagon that supports Azure Blob Storage.
We will use the Azure storage wagon.

Let’s get started by creating a maven project:

mvn archetype:generate -DgroupId=com.test.apps -DartifactId=AzureWagonTest -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false


We are going to add a simple service.

package com.test.apps;

public class HelloService {

    public String sayHello() {

        return "Hello";
    }
}


Then we are going to add the Maven wagon, which will upload and fetch our binaries to Azure Blob Storage.

<build>
    <extensions>
        <extension>
            <groupId>com.gkatzioura.maven.cloud</groupId>
            <artifactId>azure-storage-wagon</artifactId>
            <version>1.0</version>
        </extension>
    </extensions>
</build>


Then we shall create the Azure storage account that will host our artifacts.

Then we shall create a new container called snapshot. This container will contain our snapshot repositories.

We can go through the same process in order to create a release repository. Be aware that there is no need to create different containers for each repository. You can have repositories under the same container.

Now that we have set up our storage account in Azure, we shall set the distribution management on our Maven project.

<distributionManagement>
    <snapshotRepository>
        <id>my-repo-bucket-snapshot</id>
        <url>bs://mavenrepository/snapshot</url>
    </snapshotRepository>
    <repository>
        <id>my-repo-bucket-release</id>
        <url>bs://mavenrepository/release</url>
    </repository>
</distributionManagement>


From the Maven documentation:

Where as the repositories element specifies in the POM the location and manner in which Maven may download remote artifacts for use by the current project, distributionManagement specifies where (and how) this project will get to a remote repository when it is deployed. The repository elements will be used for snapshot distribution if the snapshotRepository is not defined.

The next step is the most crucial, and this has to to do with authenticating to Azure.

What you need is your storage account name and the key of the storage account. In order to retrieve both, you have to navigate to the Access keys of your Storage Account at the Settings section.

Then we shall specify our storage account credentials on ~/.m2/settings.xml:

<servers>
    <server>
        <id>my-repo-bucket-snapshot</id>
        <username>mavenrepository</username>
        <password>eXampLEkeyEMI/K7EXAMP/bPxRfiCYEXAMPLEKEY</password>
    </server>
    <server>
        <id>my-repo-bucket-release</id>
        <username>mavenrepository</username>
        <password>eXampLEkeyEMI/K7EXAMP/bPxRfiCYEXAMPLEKEY</password>
    </server>
</servers>


Be aware that you have to specify credentials for each repository specified.

And now the easiest part, which is deploying:

mvn deploy


Now since your artifact has been deployed, you can use it in another repo by specifying your repository and your wagon.

<repositories>
    <repository>
        <id>my-repo-bucket-snapshot</id>
        <url>bs://mavenrepository/snapshot</url>
    </repository>
    <repository>
        <id>my-repo-bucket-release</id>
        <url>bs://mavenrepository/release</url>
    </repository>
</repositories>

<build>
    <extensions>
        <extension>
            <groupId>com.gkatzioura.maven.cloud</groupId>
            <artifactId>azure-storage-wagon</artifactId>
            <version>1.0</version>
        </extension>
    </extensions>
</build>


That’s it! Next thing you know, your artifact will be downloaded by Maven through Azure Blob Storage and used as a dependency in your new project.

azure Apache Maven Artifact (UML) Host (Unix) Repository (version control)

Published at DZone with permission of Emmanouil Gkatziouras, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

Related

  • Private Remote Maven Repository With Artipie
  • How to Publish Artifacts to Maven Central
  • Redefining Artifact Storage: Preparing for Tomorrow's Binary Management Needs
  • Stop Using Spring Profiles Per Environment

Partner Resources

×

Comments

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

ABOUT US

  • About DZone
  • Support and feedback
  • Community research
  • Sitemap

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 100
  • Nashville, TN 37211
  • support@dzone.com

Let's be friends: