maven build code example
Example 1: what is pom.xml
- pom.xml file allows us to add, remove, manage dependencies
and versions from one single location.
- POM stands for project object model
- .xml -> stands for: extensible markup language
Example 2: example of simple maven pom java
<properties> <maven.compiler.release>11</maven.compiler.release> </properties> <build> <pluginManagement> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>3.8.1</version> </plugin> </plugins> </pluginManagement> </build>
Example 3: what is maven lifecycle
-CLEAN- Cleaning up the target folder
-VALIDATE - validating the project is correct and
all necessary information is available
-COMPILE - compiling the source code of the project
-TEST - test the compiled source code
using a suitable unit testing framework.
These tests should not require
the code be packaged or deployed
-PACKAGE - taking the compiled code and package
it in its distributable format, such as a JAR.
-VERIFY - running any checks on results of
integration tests to ensure quality criteria are met
-INSTALL - install the package into the
local repository, for use as a dependency
in other projects locally
-DEPLOY - done in the build environment,
copies the final package to the remote
repository for sharing with other developers and projects.
Example 4: The Goal that is executed to generate and deploy a documentation website is:
The Goal that is executed to generate and deploy a documentation website is:
deploy