I have a maven project in eclipse. I use mvn clean install
for installing dependencies in pom.xml
.
I want to know what mvn eclipse:clean eclipse:eclipse
command does and also the difference between these two?
The short answer mvn clean install is the command to do just that. You are calling the mvn executable, which means you need Maven installed on your machine. (see How do you install Maven?) You are using the clean command, which will delete all previously compiled Java . class files and resources (like .
mvn package: Creates JAR or WAR file for the project to convert it into a distributable format. mvn install: Deploys the packaged JAR/ WAR file to the local repository.
The Maven Clean Plugin, as the name implies, attempts to clean the files and directories generated by Maven during its build. While there are plugins that generate additional files, the Clean Plugin assumes that these files are generated inside the target directory.
The mvn install command runs the install plugin used in the install phase to add artifact(s) to the local repository. The Install Plugin uses the information in the POM (groupId, artifactId, version) to determine the proper location of the artifact within the local repository.
mvn eclipse:clean eclipse:eclipse
The second command is completely different from the first one.
First, it deletes previously generated Eclipse files (like .project
and .classpath
and .settings
) and then generates new ones, thus, effectively updating them. It may be useful if you introduced some changes in pom.xml
(like new dependencies or plugins) and want Eclipse to be aware of them.
mvn clean install
The first command deletes target
directory and then builds all you code and installs artifacts into local repository.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With