Repaso
EspaƱol
Maven, Git & SDLCFoundationsVCS-33

What does mvn clean do?

Options

  1. Removes the output of the previous build (target) (Correct option)
  2. Deletes your source code from the project folder
  3. Downloads all the dependencies again from the web
  4. Runs the tests of the project in a clean state

Answer

Removes files generated by the previous build (the target folder)

Why

Maven has several lifecycles. The clean lifecycle removes everything the previous build produced.

A typical command is mvn clean package: clean first, then compile, test and package, so old leftovers cannot cause strange results.

For a normal build, the phases run in order: validate, compile, test, package, verify, install, deploy.

Remember

clean = delete previous build output.

Key terms

Practice this question in Repaso