Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Maven clean install is equal mvn clean and after mvn install?

I have multimodule maven project. Found that:

mvn clean - takes 3 minutes after

mvn install - takes 18 minutes.

So I suppose that mvn clean install should take 21 minutes, but it takes near 30 minutes! So does it the same:

mvn clean install

and

mvn clean
mvn install

? Thanks.

like image 638
user810430 Avatar asked May 17 '12 10:05

user810430


People also ask

What is the difference between mvn install and mvn clean install?

mvn clean install tells maven to do the clean phase in each module before running the install phase for each module. mvn clean is its own build lifecycle phase (which can be thought of as an action or task) in maven. In Maven terms: clean is a phase of the clean lifecycle.

What is the difference between mvn clean install and mvn clean package?

mvn package: Creates JAR or WAR file for the project to convert it into a distributable format. mvn install: Deploys the packaged JAR/ WAR file to the local repository.

Does Maven install also clean?

mvn clean install calls clean first, then install . You have to clean manually, because clean is not a standard target goal and not executed automatically on every install. clean removes the target folder - it deletes all class files, the java docs, the jars, reports and so on.


2 Answers

AFAIK, yes, although I'm a little surprised startup/resolution/etc. takes that much time.

Things like OS-caching, JVM startup/optimization/etc., and so on would all play a role in the differences.

like image 159
Dave Newton Avatar answered Oct 23 '22 03:10

Dave Newton


let take this example

framework
    framework-utils
 foundation
    foundation-model
    foundation-api
    foundation-core

 The call order of my modules:
 1. mvn clean / mvn install:   [clean] framework-utils [clean] 
 foundation-model [clean] foundation-api [clean] foundation-core 
 [install] framework-utils [install] foundation-model [install] 
 foundation-api [install] foundation-core
 2. mvn clean install: [clean] framework-utils [install] 
 framework-utils [clean] foundation-model [install] foundation-model 
 [clean] foundation-api [install] foundation-api [clean] 
 foundation-core [install] foundation-core
like image 36
aravindKrishna Avatar answered Oct 23 '22 03:10

aravindKrishna