I use M2e + Eclipse + Maven and I would like to know what the difference is between:
Can anyone please advise?
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.
It removes whatever already-compiled files are in your project so that you can do a complete fresh rebuild.
mvn clean: Cleans the project and removes all files generated by the previous build. mvn compile: Compiles source code of the project. mvn test-compile: Compiles the test source code.
mvn clean. Clears the target directory into which Maven normally builds your project. mvn package. Builds the project and packages the resulting JAR file into the target directory.
From some quick tests, it seems that Eclipse's clean project
is only clearing out the folders that are set as output folder in the project's preferences, whereas maven's clean
is deleting the /target folder completely.
I have the following entry in my pom.xml file:
<plugin> <artifactId>maven-clean-plugin</artifactId> <version>2.4.1</version> <configuration> <excludeDefaultDirectories>true</excludeDefaultDirectories> <filesets> <fileset> <directory>target</directory> <excludes> <exclude>classes/db/**</exclude> </excludes> </fileset> </filesets> <verbose>true</verbose> </configuration>
When I do a mvn clean from the command line, the directory that I want kept (classes/db in the output directory) is not deleted, as I expect. However, when I do a Clean in Eclipse, the directory does get removed.
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