'mvn clean compile package' run the phase compiler 2 times?

2

Once I run mvn clean package I know that all phases of maven's lifecycle default prior to package (compile, test, package) , So I wonder is:

mvn clean compile package

mvn clean compile package

The reason for the question is because I saw this in a code and although it is unnecessary, the question about performance was raised.

    
asked by anonymous 03.08.2018 / 21:57

1 answer

2

Yes, the command mvn clean compile package will execute the phase compile twice .

This can be easily checked in the maven log, as shown below, in the maven-compiler-plugin:3.3:compile snippet that appears:

[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building MyProject 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ MyProject ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.3:compile (default-compile) @ MyProject ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 264 source files to C:\projetos\MyProject\target\classes
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ MyProject ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.3:compile (default-compile) @ MyProject ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 264 source files to C:\projetos\MyProject\target\classes
    
06.08.2018 / 21:00