You will notice a “site” directory in the target after executing this command. This command generates a site for the project. Recommended Reading: Creating a Java Project using Maven Archetypes 11. We can use this command to generate a skeleton maven project of different types, such as JAR, web application, maven site, etc. Maven archetypes is a maven project templating toolkit. org.mockito:mockito-junit-jupiter:jar:2.19.0:test org.mockito:mockito-core:jar:2.19.0:test maven-dependency-plugin:2.8:analyze (default-cli) Mockito-Examples. It’s useful in reducing the build size by identifying the unused dependencies and then remove it from the pom.xml file. This command analyzes the maven project to identify the unused declared and used undeclared dependencies. | \- org.objenesis:objenesis:jar:2.6:test | +- net.bytebuddy:byte-buddy-agent:jar:1.8.10:test +- org.mockito:mockito-junit-jupiter:jar:2.19.0:test | \- :junit-platform-commons:jar:1.2.0:test | +- :junit-platform-launcher:jar:1.2.0:test | +- org.apiguardian:apiguardian-api:jar:1.0.0:test +- :junit-platform-runner:jar:1.2.0:test maven-dependency-plugin:2.8:tree (default-cli) Mockito-Examples. This command generates the dependency tree of the maven project. This command validates the maven project that everything is correct and all the necessary information is available. The server entries in the maven settings.xml file is used to provide authentication details. The remote repository should be configured properly in the project pom.xml file distributionManagement tag. This command is used to deploy the artifact to the remote repository. Installing /Users/pankaj/Desktop/maven-examples/maven-example-jar/pom.xml to /Users/pankaj/.m2/repository/com/journaldev/maven/maven-example-jar/0.0.1-SNAPSHOT/maven-example-jar-0.0.1-SNAPSHOT.pom Installing /Users/pankaj/Desktop/maven-examples/maven-example-jar/target/maven-example-jar-0.0.1-SNAPSHOT.jar to /Users/pankaj/.m2/repository/com/journaldev/maven/maven-example-jar/0.0.1-SNAPSHOT/maven-example-jar-0.0.1-SNAPSHOT.jar maven-install-plugin:2.4:install (default-install) maven-example-jar. maven-resources-plugin:2.6:testResources (default-testResources) maven-example-jar. maven-resources-plugin:2.6:resources (default-resources) maven-example-jar. This command builds the maven project and installs the project files (JAR, WAR, pom.xml, etc) to the local repository. Notice the package goal executes compile, testCompile, and test goals before packaging the build. The output shows the location of the JAR file just before the “BUILD SUCCESS” message. Building jar: /Users/pankaj/Desktop/maven-examples/maven-example-jar/target/maven-example-jar-0.0.1-SNAPSHOT.jar maven-jar-plugin:2.4:jar (default-jar) maven-example-jar. Tests run: 1, Failures: 0, Errors: 0, Skipped: 0 Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.005 sec
Surefire report directory: /Users/pankaj/Desktop/maven-examples/maven-example-jar/target/surefire-reports maven-surefire-plugin:2.12.4:test (default-test) maven-example-jar. maven-compiler-plugin:3.8.1:testCompile (default-testCompile) maven-example-jar. maven-compiler-plugin:3.8.1:compile (default-compile) maven-example-jar.
This command builds the maven project and packages them into a JAR, WAR, etc. Compiling 1 source file to /Users/pankaj/Desktop/maven-examples/maven-example-jar/target/test-classes maven-compiler-plugin:3.8.1:testCompile (default-cli) maven-example-jar. This command compiles the test classes of the maven project.
Compiling 1 source file to /Users/pankaj/Desktop/maven-examples/maven-example-jar/target/classes Changes detected - recompiling the module! maven-compiler-plugin:3.8.1:compile (default-cli) maven-example-jar. This command compiles the java source classes of the maven project. Deleting /Users/pankaj/Desktop/maven-examples/maven-example-jar/target maven-clean-plugin:2.5:clean (default-clean) maven-example-jar. The command output relevant messages are shown below. To publish a Maven artifact with mvn to a CodeArtifact repository, you mustĪlso edit ~/.m2/settings.xml and the project POM.This command cleans the maven project by deleting the target directory. ĭownloading from codeartifact: Downloaded from codeartifact: (11 kB at 3.9 kB/s)ĭownloading from codeartifact: Downloading from codeartifact: Downloaded from codeartifact: (68 kB at 123 kB/s)ĭownloading from codeartifact: Downloaded from codeartifact: (54 kB at 134 kB/s) Publish artifacts