Maven is a build framework for supporting all development cycles, similar to other build systems e.g. Gradle.
When added to a project, Maven organizes the project components into a standard directory system.
Visit the PRACTICES page for accessing folders under Maven.
FIGURE OF MAVEN DIRECTORY SYSTEM:
By default, /scr serves as holder of source code and source files.
The /test folder mirrors the structure of the /main directory. The .java source files under the /test folder are for testing purposes.
The /target serves as holder of .class files and sources needed by them, also used for storing Java archives like .jar or .war files.
The structure is capable of containing no-Java files and unique directories as well.
Please note, no-Java files and folders should be placed outside the /src structure since they are no-Java files.
The pom.xml is an XML file consisting of Maven parameters (summarized as an archetype).
Maven creates a central pom upon install into its install folder (e.g. local folder/m2/repository) which consist of all dependencies the developer used after installing Maven.
Whilst extending the code, Maven will extend the project pom with tags from the central pom file. If not, can be done manually which will be synchronized with the central pom automatically in theory.
The dependency means local or remote path to a library, its name and version number, organized into XML tags. The compiler or builder will download all dependent libraries into the local Maven central and use references to that.
The scope of the dependency marks whether the dependency will be used for all or just for testing purposes. Use the <scope> tag to define this within a <dependency> tag. Using this tag is optional, default value (in case it is not defined explicitly) is runtime. In case of test scope, the corresponding dependency will not be built into the target.
If there is a dependency for a library, still it is a need to import that library in the code as well.
In case of any malfunctions, use mvn clean, then mvn install commands from the terminal.
In case version upgrade is needed in code, following version upgrade in the dependency (not the package, only the version), modify the version tag only. Be aware to check the code before publishing or deploying.
EXAMPLE FOR INSERTING NEW REMOTE DEPENDENCY IN POM.XML:
EXAMPLE FOR IMPORTING DEPENDENCY IN CODE:
The development lifecycle is rendered into Maven commands. These commands can be accessed through the IDE but can be different in other IDEs. All IDE should have terminal in which accessing Maven is universalized.