Why is there a difference in Java code compilation: mvn verify vs mvn compile

Viewed 51

Short version: Does mvn compile and mvn verify compile the code in the same way?

Problem:

I have a multimodule project. And using Maven v3.6.

POM looks like this:

    <modules>
        <module>common</module>
        <module>server</module>
        <module>plugins</module>
    </modules>

A class in server module got modified where a new method got added. A class in plugins module is calling that method.

Build is successful with following maven commands:

mvn clean
mvn compile
mvn -DskipTests verify

but compilation of plugin module fails when we run:


mvn clean
mvn -DskipTests verify

with an error that complains about not finding new method in server module class:

error: cannot find symbol

So, why is this difference in behaviour. As per this documentation verify should first call compile. So effectively the same thing as first version of commands.

Notes:

  • Also fails mvn -DskipTests compile verify
  • Successfully builds : mvn -DskipTests install

I do not want to resort to mvn install as advice against over here

Regards

0 Answers
Related