AWS, Cloud Computing, DevOps

3 Mins Read

Streamlining Your Java Projects by Pushing Java Artifacts to Nexus Maven Repository in AWS CodeBuild


In the realm of software development, managing dependencies efficiently is paramount. This is where a powerful artifact repository manager like Nexus comes into play. Nexus provides a centralized hub for storing, managing, and distributing software artifacts, offering a streamlined approach to handle dependencies throughout the development lifecycle. In this blog, we will delve into the significance of Nexus, its features, the distinction between snapshot and release JARs, and why preserving JAR files on Nexus is crucial. Furthermore, we’ll walk through the steps to push Java artifacts (JAR files) to Nexus Maven Repository using AWS CodeBuild.

What is Nexus and its Features?

Nexus is a repository manager that is a central hub for storing, organizing, and distributing software components. It supports various package formats, including Maven, npm, and Docker. Nexus simplifies the management of dependencies by providing a single source for all artifacts, ensuring consistency and reliability in the software development process.

Key features of Nexus include:

  1. Artifact Hosting: Nexus acts as a repository for hosting and managing artifacts, such as JAR files, ensuring a centralized and easily accessible location for developers.
  2. Proxying and Caching: Nexus can proxy and cache external repositories, reducing build times and minimizing external dependencies.
  3. Security and Access Control: Nexus allows for fine-grained access control, ensuring only authorised users can access specific artifacts and repositories.
  4. Search and Browse: With Nexus, developers can efficiently search for artifacts, view dependencies, and browse repositories, enhancing visibility into the software components used in a project.

Pioneers in Cloud Consulting & Migration Services

  • Reduced infrastructural costs
  • Accelerated application deployment
Get Started

Snapshot vs. Release JARs

In the Maven world, artifacts, particularly JAR files, can be categorized as either snapshot or release.

  • Snapshot JARs: These are versions of artifacts under active development. They are typically suffixed with “-SNAPSHOT” and represent works in progress. Snapshot versions can be overwritten, making them suitable for continuous integration and development.
  • Release JARs: These versions are considered stable and finalized. Once released, they remain immutable, ensuring consistency and reliability across different environments.

Why Preserve JAR Files on Nexus?

Preserving JAR files on Nexus offers several advantages:

  1. Centralized Storage: Nexus provides a central repository for storing artifacts, avoiding the need for scattered and unmanaged JAR files across different environments.
  2. Version Control: Nexus allows for versioning of artifacts, ensuring that specific versions of JAR files are preserved and can be retrieved at any time.
  3. Dependency Management: With Nexus, teams can efficiently manage dependencies by using specific versions of JAR files stored in the repository, promoting consistency in development and deployment.
  4. Build Stability: By storing both snapshot and release JARs on Nexus, teams can ensure the stability of builds and deployments, especially when transitioning from development to production environments.

Pushing Java Artifacts to Nexus Maven Repository with AWS CodeBuild

Now, let’s explore the steps to push Java artifacts to Nexus Maven Repository using AWS CodeBuild.

1. Set Up Nexus Repository:

Create a Maven repository in Nexus to host your Java artifacts.

2. Create a Role with limited privileges:

Create a role with should contain only adding the maven artefacts to maven repository.

3. Setup maven user:

Create a user on Nexus, which will be configured in AWS CodeBuild with limited with the role created previously.

4. Configure AWS CodeBuild:

Set up a CodeBuild project in the AWS Management Console.

Define your build specifications in the yml file, including the below Maven command for building and packaging your Java project.

5. Add settings.xml file in the root path of the source code:

Add the following given code into the file called settings.xml, which contains to credentials of the Nexus user.

6. Modify the pom.xml by adding the distribution management:

7. Integrate Nexus Credentials

Securely integrate Nexus credentials into your AWS CodeBuild project. Use AWS Secrets Manager or environment variables to store and retrieve Nexus credentials during the build process.

8. Build and Push Artifacts:

Configure your build to execute Maven goals for building and packaging your Java project.

Include Maven goals to deploy artifacts to the Nexus Maven Repository.

9. Verify Artifacts in Nexus

After a successful build, verify that your Java artifacts are available in the configured Nexus Maven Repository.


In summary, leveraging Nexus as a Maven repository manager provides a centralized solution for storing and managing Java artifacts. With AWS CodeBuild, teams can seamlessly integrate their build processes with Nexus, ensuring a smooth and controlled flow of artifacts through the development pipeline. Preserving JAR files on Nexus enhances version control, simplifies dependency management, and contributes to building stability.

Get your new hires billable within 1-60 days. Experience our Capability Development Framework today.

  • Cloud Training
  • Customized Training
  • Experiential Learning
Read More

About CloudThat

CloudThat is a leading provider of Cloud Training and Consulting services with a global presence in India, the USA, Asia, Europe, and Africa. Specializing in AWS, Microsoft Azure, GCP, VMware, Databricks, and more, the company serves mid-market and enterprise clients, offering comprehensive expertise in Cloud Migration, Data Platforms, DevOps, IoT, AI/ML, and more.

CloudThat is recognized as a top-tier partner with AWS and Microsoft, including the prestigious ‘Think Big’ partner award from AWS and the Microsoft Superstars FY 2023 award in Asia & India. Having trained 650k+ professionals in 500+ cloud certifications and completed 300+ consulting projects globally, CloudThat is an official AWS Advanced Consulting Partner, AWS Training Partner, AWS Migration Partner, AWS Data and Analytics Partner, AWS DevOps Competency Partner, Amazon QuickSight Service Delivery Partner, Amazon EKS Service Delivery Partner, Microsoft Gold Partner, AWS Microsoft Workload Partners, Amazon EC2 Service Delivery Partner, and many more.

To get started, go through our Consultancy page, Managed Services Package, and CloudThat’s offerings.


1. Why should I use Nexus with AWS CodeBuild?

ANS: – Nexus acts as a central repository for artifacts, providing a reliable and organized storage solution. Integrating Nexus with AWS CodeBuild ensures efficient build processes, enhances dependency management, and promotes consistency in artifact usage across development and deployment stages.

2. What is the significance of snapshotting and releasing JARs?

ANS: – Snapshot JARs represent artifacts under active development, while release JARs are stable and finalized versions. Managing both types on Nexus allows teams to control the stability of their builds and ensures consistent deployments.

3. How does preserving JAR files on Nexus contribute to build stability?

ANS: – Preserving JAR files on Nexus ensures that specific versions of artifacts are available for builds and deployments. It promotes build stability by allowing teams to use controlled and versioned artifacts, reducing the risk of inconsistencies across environments. By following these best practices, developers can establish a robust and streamlined process for pushing Java artifacts to Nexus Maven Repository using AWS CodeBuild, contributing to a more efficient and reliable software development lifecycle.


Deepak S works as a Research Intern at CloudThat. His expertise lies in AWS's services. Deepak is good at haunting new technologies and automobile enthusiasts.



    Click to Comment

Get The Most Out Of Us

Our support doesn't end here. We have monthly newsletters, study guides, practice questions, and more to assist you in upgrading your cloud career. Subscribe to get them all!