Hosting the jar file to Nexus !!!!
Prerequisite: Must Know About Maven and Configure your Nexus at a local machine.
Deploying maven created jar file at the Nexus repository manager platform.
Step-1:
Download nexus 3.18.1–01. Extract it you will find two files:
a. nexus-3.18.1–01 b. sonatype-work (here Configurations are stored)
run command : nexus.exe /run
You will see such a screen in your command line.
Step-2:
Open browser and type localhost:8081
Nexus Repository Dashboard will be open.
Sign-in in your dashboard, It will ask for the password first
Configure Your password:
Goto “sonatype-work > nexus3>admin.password”
Open the file admin.password, Copy the unique/one-time key and paste at the password option
After this, it will ask for the new password and submit and you will enter in your nexus Homepage.
Step-3:
To Create Repository
Go to “Setting> Repository> Create Repository” and click
Now select the “maven (hosted)” type repository because we are working on a maven project.
Configurations required :
a. Give a name for the project
b. In Version policy: Select “Snapshot” as our maven project version in the snapshot.
c. In Hosted: Select Allow redeploy so we can re-deploy it at any time.
Now Create the repo.
Step-4:
Goto maven folder location, open Conf folder, and then open settings XML document.
Write the below command too.
a. Id can be anything according to you.
b. Username and password same as nexus repo manager web application
<server>
<id>cicd_lab8</id
<username>admin</username> <password>Kushagra@121</password>
</server>
Step-5:
Since we have to deploy so we will run mvn deploy command.
For this, we have some changes in our maven project pom file to connect to the nexus repo manager.
Configurations:
<maven.compiler.source>1.6</maven.compiler.source>
<maven.compiler.target>1.6</maven.compiler.target>
<distributionManagement>
<snapshotRepository>
<id>upes</id>
<name>upes</name>
<url>http://localhost:8081/repository/cicd_lab8/</url>
</snapshotRepository>
</distributionManagement>
Step-6:
Goto the maven project where the pom file is stored.
Run the command “mvn deploy”
This command will automatically run the maven goal before the deploy goal like the clean and install goal of maven.
jar file will be created and will host the jar file to the nexus repo manager.
Thank You !!!
Kushagra Bansal…