What is Code Build?
Apps need to be deployed on dev or test or production servers, to do this pack the application code and its dependencies into a single file means compiling the code, compress the hundreds of code files in to single file, this single file is called as application Artefact this file will be moved to the servers where the application is available to the client, packing the code is also called building the code.
What is artefact storage?
The storage where we keep the artefact once we build the application code and dependencies.
Examples of artefact storage: NEXUS, Jfrog artifactory.
What is the artefact file format ?
Artefact file format is dependents on programming language we use for coding
Example: JAR or WAR file format for Java application.
What are the build tools in devops?
Examaple: Maven, Gradle, ant etc for Java, microsoft build engine and Nant for DOTNET, pybuilder for python etc
What is Maven ?
Maven is a build automation tool which can help you automate the built process of your project. What exactly it means. Lets see. Suppose you are working on a project which is very huge and you have to earn lot many third party dependencies and libraries to your project. Particularly for java project we may be using so many third party libraries. So if the project is so huge and if you have to add lot may dependencies manually, it is very challenging and (0.32) job.
Also if these dependencies are getting upgraded ,again you have to add the different versions of those dependencies, the way the task becomes much more complicit and much more hectic, so this can be handled very easily through Maven. Maven can dynamically add the dependencies to your project. So this problem can be overcome by using build automation tool called Maven. Particularly the projects like devops where you need continuous builds, continuous integration and continuous testing, there comes the need of a build automation tool which can help you to execute these tasks continuously and repetitively.
So again Maven or any build automation tool comes in the picture, So Maven is used to automate the build process of adding the dependences to your project of a continuously integrating, testing, building, all these task can be done through Maven very easily. As well as Maven can also be used to document the project so well. So these are all the major things which a build automation can do particularly which Maven can do. There are many built automation tools like Maven, Ant, Gradle, Nant, pybuilder and so on. Maven is basically for the java products, but it can also be used for other projects like sea shork, ruby, scala and so on. And Ant is also for Java, Gradle is also for Java projects and End Ant is for dotnet applications . And then pie builder to build Python projects. So this is how we have different build automation tools.
The major concept is same but the way they work may be different. In Maven we will be using very important component called Pom. We will talk about Maven architecture and the Pom file in detail.
Maven is an Advance Project Management and Build tool for Java Project and Maven is based on Project Object Model. To work with Maven, creating this Project Object Model called POM file is mandatory.
POM file is an XML file and this is written by Developers and it is placed along with the Source Code. So this plays a very important role to work with Maven. Whenever you are running any commands in Maven like, let’s suppose you are running a command called MVN compile from the command line, so Maven will look for the information in the POM file.
POM file is like a heart for Maven. All the information of the Dependencies of the Project and all the Plugins that are required for the Project, all this information would be present in the POM file. So whenever we are running any Maven command, Maven will search for information in this POM file and download the Dependencies and the Plugins accordingly.
So POM file is very important and mandatory file for Maven. And ok it is downloading the Dependencies by getting information from the POM file, but where it is downloading the Dependencies? Maven is having three repositories called Local Repository, Central Repository and Remote Repository.
Local Repository is nothing but on the same server where you are running Maven. So that’s like a Local Casey. It will first search for those Dependencies and plugins in the Local Repository. They are not available locally, then it will go to the Central Repository and search this and download the Dependencies and plugins.
Central Repository is a repository managed by Maven community and this will have all the more widely used Plugins and the Libraries, Jars and all.
So Maven will search the Central Repository over the internet and download the Dependencies and the Plugins and place them in the Local Repository. So this is how it works. For the next time if it needs same Dependencies it will use them from the Local Casey without downloading it again from the Central Repository. So the job becomes faster because it was downloading the Dependencies from the Central Repository, so the internet only for the first time. So from next time on it was using the Jars and all which were already downloaded and present in the Local Casey. So this is how Maven works and let’s suppose it has not found the Dependencies in the Local Repository, it will search the Central Repository and download them. And if it does not find the Dependencies in the Central Repository, and then it will again search another Repository called Remote Repository.
Remote Repository is nothing but which is developers own custom created Repository containing all the required Libraries and the Jars for the Project. So if the Dependencies are not available here, it will search this and download them. So this is how it works. And this Remote Repository location will also be documented in the POM file. So the POM file is a very important file which will have all the information of the dependencies needed for the Project, all the Plugging that are required to execute tasks on the Project as well as the Remote Repository address, everything will be documented in the POM file. So this is how Maven works.