build a maven java project code example

Example 1: mvn build project

# one of the following
# compiles java classes
mvn compile  
# creates a jar in target folder
mavn package
# creates a jar in target folder and adds to your local .m2 repository
mvn install

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>