'mvn clean Compile package' runs Phase Compiler 2 times?

Asked

Viewed 57 times

2

Once if I run mvn clean package i know that consequently will run all phases of the default Lifecycle from Maven prior to package (Compile, test, package), so it is:

calling for mvn clean Compile package Phase Compile will be executed 2x?

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

1 answer

2


Yes, the command mvn clean compile package will run the Phase Compile twice.

This can be easily checked in the Maven log, as example below, in the excerpt maven-compiler-plugin:3.3:compile that sometimes 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
  • 1

    So to get the most performance would be to send alone mvn clean package?

  • 1

    Of course. It doesn’t even make sense the Compile package command, because as you said yourself, the package already does the Compile.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.