![Forrest logo](/images/logo.png)
mvn
Maven (MVN) is a popular command line tool for building, packaging, and managing Java-based projects. It stands for "Maven" and is based on the concept of project object model (POM). Using a declarative XML-based file called the POM, Maven provides a structured approach to handle builds and dependencies. Maven automates the process of downloading dependencies from remote repositories and managing their versions. It organizes a project into a standardized directory structure, making it easier to navigate and understand. Maven supports various build lifecycles, which comprise of a series of phases such as compiling, testing, packaging, and deploying. It has a vast ecosystem of plugins that extend its functionality to cover a wide range of tasks like code analysis, documentation generation, and deployment to various targets. Maven integrates well with popular IDEs like Eclipse and IntelliJ, making it seamless to work with both command line and GUI environments. Maven is highly extensible and customizable, allowing developers to define their own plugins and configurations as required. By encouraging best practices and providing a consistent way to manage projects, Maven simplifies the development process and improves collaboration among teams.
List of commands for mvn:
-
mvn:tldr:0268a mvn: Run a class with a main method.$ mvn exec:java -Dexec.mainClass="${com-example-Main}" -Dexec.args="${arg1 arg2}"try on your machineexplain this command
-
mvn:tldr:272a9 mvn: Delete build artifacts from the target directory.$ mvn cleantry on your machineexplain this command
-
mvn:tldr:2b874 mvn: Compile and package the compiled code in its distributable format, such as a `jar`.$ mvn packagetry on your machineexplain this command
-
mvn:tldr:40c94 mvn: Install the built package in local maven repository. (This will invoke the compile and package commands too).$ mvn installtry on your machineexplain this command
-
mvn:tldr:45f59 mvn: Compile and package, skipping unit tests.$ mvn package -DskipTeststry on your machineexplain this command
-
mvn:tldr:d252c mvn: Clean and then package the code with a given build profile.$ mvn clean -P${profile} packagetry on your machineexplain this command
-
mvn:tldr:ea9d9 mvn: Do a clean and then invoke the package phase.$ mvn clean packagetry on your machineexplain this command