Setting Maven Project With Jfog#
Generate Maven Setting.xml#
- Maven provides a settings file –
settings.xml. This allows us to specify which local and remote repositories it will use. We can also use it to store settings that we don't want in our source code, such as credentials. - Now, click on button
Set Me Upas in the image below
- Then you need to choose
Package Type as Maven, the Repository as maven-virtual. In this example we will use maven-virtual that we created before, this repository will contain both maven-local and maven-remote.
- Next in tag Configure you choose Generate Setting, then click Download Snippet, then you will received a file setting.xml
- Then you need to open
setting.xmlfile and put your encrypted password as in the image below
- You can get your encrypted password from your Jfog profile as the image below
- Finally, put this
setting.xmlfile into.m2folder of Maven in your machine.
Generate Deploy Setting For Pom.xml#
- To deploy our binary source code of our projects to Jfog, we need to configure our
pom.xml. So let's go to Jfog again and click on buttonSet Me Up. Then you need to choosePackage Typeas Maven, theRepositoryas maven-local, this is because we want maven-local will be only the repository to contain only our binary source codes. Then click on tagdeployand copy the xml script as the image below.
- Then go to
pom.xmlof your project and paste the script as in the image below
Testing#
- Now, In your spring-boot project, use the command
mvn deployto deploy your binary jar file tomaven-localrepository of jfog. - After the build is successful, you can go to jfog then view the result of your deployment as in the image below.
- Then if other projects need to use your deployed artifactory as a dependency, we just need to copy dependency xml script of jfog as in the image above and paste it into pom.xml for using.
- So that's it, see you next time.