简体   繁体   English

每次构建(包装)之前都要清洁

[英]clean before every build (package)

Regardless of build tool, I have seen people doing a clean task/phase before every time they do package/compile or ... is it really necessary? 无论使用哪种构建工具,我都看到人们在每次打包/编译之前都会执行一个干净的任务/阶段,或者...真的有必要吗? Dose build tools use reuse artifacts of previous builds? 剂量构建工具是否使用先前构建的重用工件?

Most of the time you see clean install as the default command, but I would encourage everybody to use verify instead. 大多数情况下,您会将clean install作为默认命令,但我鼓励所有人都使用verify

When executing clean the target-folder is removed which makes it impossible to do incremental builds. 执行clean将删除目标文件夹,这使得无法进行增量构建。 Plugins have enough information to detect if they should do their action. 插件具有足够的信息来检测是否应该执行其操作。 For instance: the maven-compiler-plugin compares the java sourcesfiles and the compiled classfiles (and other things) to see if files needs to be (re)compiled. 例如:maven-compiler-plugin比较Java源文件和已编译的类文件(以及其他内容),以查看是否需要(重新)编译文件。 If you think that a plugin is not working correctly with incremental builds, please file an issue for that plugin. 如果您认为插件无法在增量版本中正常使用,请对该插件提出问题。

The install was often required with multimodules in Maven2, but Maven3 is capable to resolve these inner module dependency references. Maven2中的多模块通常需要install ,但是Maven3能够解析这些内部模块依赖性引用。 The only thing 'install' does is copying artifacts to the local repository (=IO=expensive). “安装”唯一要做的就是将工件复制到本地存储库(= IO =昂贵)。 And it'll make your local repo look different compared to your coworkers, which might give different results during builds. 与同事相比,这会使您的本地存储库看起来有所不同,在构建期间可能会产生不同的结果。 Better to let a buildserver push those artifacts to the shared remote repositories and let every pull those SNAPSHOTs from there. 最好让构建服务器将这些工件推送到共享的远程存储库,然后让每个人都从那里拉那些SNAPSHOT。 Only in rare cases calling install is valid (experienced Maven users know when :) ), so instead please use verify . 仅在极少数情况下,调用install是有效的(有经验的Maven用户知道何时:)),因此,请使用verify

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

相关问题 Jaxb2使用每个mvn clean软件包重新生成类 - Jaxb2 regenerate classes with every mvn clean package 在mvn clean程序包中仅构建一次WAR - Build WAR only once during mvn clean package Maven-如何为每个Java包构建一个jar - Maven - how to build a jar for every java package Maven - 为什么在“mvn clean”之后我需要在“mvn package”之前执行“Maven Update Project”? - Maven - Why after “mvn clean” I need to execute “Maven Update Project” before “mvn package”? Allure:目标文件夹中的环境文件在maven clean上被删除。如何在每次构建时生成它? - Allure: Environment file in target folder gets deleted on maven clean. How do I generate it on every build? 使用“ mvn clean package”构建Livy时,无法在存储库中找到jar - Failure to find jar in repository when I build Livy using “mvn clean package” 为什么执行“ mvn clean package”以生成Spark失败并显示“某些Enforcer规则失败”? - Why does executing “mvn clean package” to build Spark fail with “Some Enforcer rules have failed”? MVN清洁套件中的错误-DskipTests - Error in mvn clean package -DskipTests Maven自动清洁包装 - Maven auto-clean on package 在 Maven 中指定目标清洁 package - specifying goal in Maven clean package
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM