PatPanda
PatPanda

Reputation: 5042

"mvn clean install" runs tests, but not "mvn clean site"

small question regarding Maven, and the difference between install and site.

When running a very basic clean install, I can see the unit tests run fine, no problem at all.

Then, I got the requirement to generate a website for the project, to put the test report, javadoc, etc...

Therefore, I just went one step further into the maven lifecycle, mvn clean site instead of mvn clean install.

However, surprised, mvn clean site seems not to run test cases. (nothing changed from the mvn clean install run).

May I ask if this is expected? (site not running tests)

And also, how to tell maven to also run tests during the site phase please?

Thank you

Upvotes: 0

Views: 993

Answers (2)

dunni
dunni

Reputation: 44555

If you look at the lifecycle documentation from Maven (https://maven.apache.org/guides/introduction/introduction-to-the-lifecycle.html#lifecycle-reference), you can see, that the site lifecycle is a separate lifecycle from the default lifecycle. Thus the site phase does not execute anything from the default lifecycle and you have to specify any phases, that you want to execute from the default lifecycle, in the command.

Upvotes: 2

AlBlue
AlBlue

Reputation: 24060

Yes, this is expected. You can run mvn clean test site if you want to run tests as well.

Upvotes: 0

Related Questions