简体   繁体   English

是否需要在 mvn spring-boot:run 之前进行 mvn 全新安装

[英]is it required to mvn clean install before mvn spring-boot:run

Pulled an existing project form Git Repo从 Git 回购中提取现有项目

I tried running it using mvn spring-boot:run , but it gave error我尝试使用mvn spring-boot:run运行它,但它给出了错误

Then performed a mvn clean install then did mvn spring-boot:run , and it got running !!!然后执行mvn clean install然后执行mvn spring-boot:run ,它开始运行了!!!

Earlier I was supposing mvn spring-boot:run performs the task of mvn clean install also !之前我假设mvn spring-boot:run也执行mvn clean install的任务!

But then, How does mvn spring-boot:run considers latest code at compilation (I mean if it is not doing install it should not be compiling, so it should be running the stale JAR, but it takes the new code changes and refreshes the JAR)但是,然后,如何mvn spring-boot:run在编译时考虑最新代码(我的意思是,如果它没有进行install ,它不应该编译,所以它应该运行过时的 JAR,但它需要新的代码更改并刷新 JAR)

Can somebody through some light on the confusion !有人可以通过一些了解混乱!

mvn clean install is used to resolve dependencies that are listed on your pom.xml . mvn clean install用于解决pom.xml上列出的依赖项。 You don't need to run it if there are no changes to your pom.xml .如果您的pom.xml没有更改,则不需要运行它。 The error was most likely due to your local not having all the dependencies required.该错误很可能是由于您的本地没有所需的所有依赖项。

The only difference between mvn spring-boot:run and mvn clean install is the later phases after testCompile phase. mvn spring-boot:runmvn clean install之间的唯一区别是testCompile阶段之后的后期阶段。 Please refer to attached screenshots.请参阅随附的屏幕截图。

mvn spring-boot:run

在此处输入图像描述

mvn clean install

在此处输入图像描述

The later steps after running tests in mvn clean install are -在 mvn clean install 中运行测试后的后续步骤是 -

Building jar, repackage, install (default-install)构建 jar,重新打包,安装(默认安装)

However as compilation is done, so any changes in source code must be reflected in either case.但是,随着编译完成,源代码中的任何更改都必须反映在任何一种情况下。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM