> For the complete documentation index, see [llms.txt](https://dev7days.gitbook.io/dev7days/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://dev7days.gitbook.io/dev7days/java/maven-cli.md).

# Maven CLI

**Command**

1. `mvn validate`= Validate the project is correct and all necessary information is available. This phase checks the project's POM file and ensures that all required configurations and dependencies are defined correctly
2. `mvn clean` = It is a Maven command that is used to remove the `target` directory from your project. The `target` directory is where Maven stores all the compiled classes, JAR files, WAR files, and other artifacts generated during the build process. Running `mvn clean` ensures that the next build starts from a clean slate.
3. `mvn test`= Test the compiled source code using a suitable unit testing framework.
4. `mvn compile` = Compile the source code of the project. It processes the resources and source code to generate the bytecode (i.e., the `.class` files from `.java` files). It does not package the code into a `JAR` or `WAR` file, nor does it run tests or other build phases.
5. `mvn package` = Take the compiled code and package it into its distributable format, such as a `JAR`. It runs all lifecycle phases up to `package`, including `compile` and `test` phases. It does not install the package into the local Maven repository.
6. `mvn install` = This command runs all the phases in the default lifecycle up to `install`. It is not only packages the code but also installs the package into the local Maven repository (`~/.m2/repository`), making it available for other projects on the same machine. The phases executed include `validate`, `compile`, `test`, `package`, and `install`.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://dev7days.gitbook.io/dev7days/java/maven-cli.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
