What is the usage of clean install in Maven?
In Maven, “clean install” is a commonly used command combination that is used to perform the following actions:
- Remove all files and directories generated from the previous build. This will delete the target directory and all its contents.
- Install: Place the artifact generated from the project build (e.g. JAR file) into the local Maven repository for other projects to reference.
By using the clean install command, it ensures that the project is built in a clean state and installs the generated artifacts to the local Maven repository.
Example command: mvn clean install
Before executing this command, make sure you are in the root directory of the project and have properly configured the Maven environment.