JFrog Integration with Maven

Michael Mensah
6 min readMar 15, 2022

The purpose of this project is to move the artifact after the build process is successful to a virtual repository call JFrog Artifactory to store the artifact file


  1. You must have an AWS account to create infrastructure resources on AWS cloud.
  2. GitHub or Bitbucket to clone your code for the build
  3. JFrog Antifactory account to store artifacts files

Lets begin the process — Launch your instance to begin the build process. My instance name is Maven Build

After instance is launched login to the server and change the user to Root with the command — sudo su -

Download Maven from the the Maven website site. Copy and paste the link to your server to begin the download with the command wget apache-maven-3.8.5-bin.zip. Screenshot below

Once the link is downloaded the next step is to unzip the file with command unzip apache -maven-3.8.4-bin.zip. Use the Cd command to change directory to the file apache-maven-3.8.4 and the ls -la command to see all the config files in your maven file.

The next step is to install a few application to help with the build process. We will install Java OpenJDK with the command yum install java-1.8.0-openjdk-devel -y. Once Java is install the next application to install is GIT with the command yum git install -y

Once the Java and GIT application are both installed. The next process is to GIT pull the code from a remote repo from GitHub or Bitbucket to the server to store the code for the build process. Copy and paste your clone link to the server press ENTER on the keyboard to clone code to server. Once that is done you will see your code (java login — app)on the server.

The next step is to begin the build process. To begin the build process you have to change directory to where the pom.xml file is with the command cd java-login-app/ and then ls -la to see the files in the entire code file.

In the pom.xml present working directory is where the build process will take place with the command /opt/apache-maven-3.8.5/bin/mvn package. Once build is completed the output of the build will read as BUILD SUCCESS. Screenshot below

Once the build is successful you will see a directory call target which wasn’t there formally, but after the build the target directory is there. and inside the target directory is where our code will be package nicely to be moved to the Jfrog.

The next step is to head over to the JFrog website. Create an account and login. After a creating an account. Open the home page and click on Quickset up, which show you the list of application that can save their artifacts in this remote repo (JFrog).

Create a repo for Maven by selecting Default-maven-local and create a new repository and assign a name to your new repositories by adding a meaningful prefix identifier. Screenshot below

After you create the repo. Click “Generated setting” below to configure and copy and paste this settings to maven repository call .m2. Copy the setting to Vscode to make the changes. Changes will include adding your username and password to make it easy for maven to authenticate when pushing code after the build process to JFrog successfully.

In the setting files you have to define the credentials by putting in your username and password so maven an authenticate and push code to JFrog. Afterward, define that the artifact has to be resolvable by which virtual repo by default. In this case the default is — Default -maven-virtual

After the setting files have been configured. Click on the Set me up to define which repository you want to move your artifact to in my my case I will move it to projectdevcloud-libs-release-local. Afterward, below Set Me Up click on the Deploy to generate the code which the plugins on where the java source code will be save in JFrog by add the code to the pom.xml file.

After this is done. Head over to your Maven server to complete the process by configuring the setting in a way that it will be able to push code to the JFrog artifact. Use the command cd /root — then the command cd .m2 which is the local repository in the maven server where I will be copying and pasting the dependency. Use the command vi settings.xml then copy and paste the dependency code generated from JFrog. .m2 is local repo folder which supplies the required configuration details to your build process

The next step is to add the distribution setting code to your pom.xml file to tell maven which repository location to post the artifact to.

After the distribution is added to the pom.xml. Run the mvn package command to build and prepare the artifact to push to JFrog. Run another command mvn deploy to push your artifact to your JFrog artifactory.

Refresh your JFrog webpage to see if your artifact was successfully deployed to the local antifactory location I specified. Yes artifact was SUCCESSFULLY deployed to the right location.

Conclusion — You have seen the step by step tutorial how to push an artifact to an antifactory account to store codes after is been compile, built and packaged to be deployed to an app server (Tomcat) to serve users.

Much you for stopping by as usual to ready my block post.