Forrest logo
back to the mvn tool

mvn:tldr:272a9

mvn: Delete build artifacts from the target directory.
$ mvn clean
try on your machine

The command mvn clean is used in the Maven build tool to clean the project's workspace by removing any previously generated files or artifacts.

Here's a breakdown of what each part of the command means:

  • mvn: This is the command to execute Maven. It is followed by various options and arguments.
  • clean: This is one of the lifecycle phases in Maven. The clean phase ensures that the project's workspace is in a clean state before proceeding with the build process. It removes any compiled classes, generated files, and artifacts that were previously created.

When you run mvn clean, Maven will remove the target directory (by default) where the compiled classes, packaged artifacts, and any other generated files are placed during the build process.

The clean phase is often used as a good practice before starting a new build, ensuring that the build is not influenced by any leftovers from previous builds.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the mvn tool