Build Systems - Intro
What is it?
This post will be about automatic build systems. I think it is intuitively clear what this is and why it is needed, but for formality you need to write - these are software products that, based on some configuration, can "assemble" your project.
Under the word "collect" here can be hidden a very vast amount of work, which with a "manual" approach requires a significant investment of time.
A small list for clarity:
- Download dependent libraries for your project from the network (repository);
- compile module classes or the entire project;
- generate additional files: SQL scripts, XML configs, etc .;
- delete / create directories and copy the specified files into them;
- packing compiled project classes into archives of various formats: zip, rar, rpm, jar, ear, war, etc .;
- compilation and launch of unit tests of your project with the results of the tests and calculation of the percentage of coverage;
- installation (deploy) of project files to a remote server;
- generation of documentation and reports.
The most popular representatives of such systems are Ant + Ivy, Maven.
There are a number of articles about Maven on the hub, but, unfortunately, they are all in different hubs, because There is no separate hub for build systems.
Therefore, I decided “not to be like everyone else” and choose the general hub “Programming”, and not “Java”, “Web Development”, etc.
Therefore, not an interested reader can continue his search for interesting, but interested reader can read more.
I specifically started the post with explanations and a description of the features, since these systems can build not only for Java and are applicable not only in web development. The possibilities and options for using these systems are much wider.
In the end, they may not even compile the code at all, but do automatic routine work: generation, archiving, file operations, installation on the server - which allows developers to spend their time more efficiently .
The architecture of all build-systems is as follows:
- own configuration where "personal" system settings are stored. For example, such as information about the installation location or environment, information about repositories, etc.
- module configuration, which describes the location of the project, its dependencies and tasks that need to be performed for the project;
- configuration parsers
- a parser capable of "reading" the configuration of the system itself, to configure it accordingly;
- module configuration parser, where some “human-readable” terms describe tasks for the assembly system;
- the system itself is some utility + script to run it in your OS, which, after reading all the configurations, will begin to execute one or another algorithm necessary to implement the launched task;
- plug-in system - additional plug-in add-ons for the system, which describe algorithms for implementing typical tasks;
- local repository - a repository located on the local machine for caching requested files on remote repositories.
For people unfamiliar with terminology: a repository is some structured repository of some data. For example, various auxiliary libraries / plugins / scripts / documentation / sources, etc.
On this, I will finish the general part about build systems and move on to more specific things.
Since it would be wrong to rewrite what others wrote, I will give a list of articles on the topic that are already on the Maven hub and which specifically describes this system - what it is, how it works, and on what principles it is based.
I advise you to read in this order:
- Maven - why? - An introductory article about Maven, which describes how the configuration of the module / project, the assembly life cycle is arranged.
- Apache Maven - basics - terminology, installation, assembly, creating a project from an archetype, useful links
- Maven - automation of the project’s assembly - a more detailed description of the assembly life cycle, description of the deploy settings (deploy), using the installation example for Tomcat server.
- Creating your own archetypes and catalogs in Maven is for people already “in the know” and wanting to create their own archetypes if for some reason there are not enough existing ones. The process is described in some detail.
The purpose of this article was to convey to the reader information about assembly systems in general, why they are needed and what tasks they can perform.
I take my leave on this and hope that this article will find its reader who is not afraid to use such systems for their daily tasks, and will show the simplicity and effectiveness of project assembly systems.
Continued: Build Systems - Local Repository