[英]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.