We are running our continuous builds on Hudson currently with "mvn clean verify". That is what we always did and so we never questioned it.
The question is: Is it safe to run a continuous build with "mvn verify" only? So that would mean the maven-compiler-plugin would only compile classes that got changed since the last build and save precious time.
Will the feedback be the same quality as with "clean" or are there any drawbacks to be expected?
The product being tested is a typical Java web application with lots of generated code (JSPs, reports). There is also code around using Dependency Injection.
You can also call it as mvn clean verify which means: first clean up the output directory, next build the project and verify the outcome.
There isn't any difference observed in the mvn verify and mvn test command output.
A clean is required to get rid of the stale files so that they doesn't get accidentally included in WARs, JARs and so on. In addition, certain plugins require a clean in order to work properly. For example (at least in Maven 2), the maven-war-plugin explodes each dependent WAR into an existing directory tree.
mvn package command will compile source code and also package it as a jar or war as per pom file and put it into the target folder(by default). mvn install command will compile and package, but it will also put the package in your local repository.
No, it's not safe! The Maven compiler plugin is not smart enough to figure out that the API of a class A
has changed and that it should check all other classes which use this API, too. It will only compile A
and create a jar with a lot of broken classes.
Note: It's usually better to run mvn clean
in advance and then run the build/verify/compile/install. That allows you to run the second command several times without cleaning all the time.
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