由于maven 3强烈建议指定插件的版本。例如,指定(以指定Java目标版本)行家编译-插件,行家抱怨如果未指定版本:maven 3:必须指定插件版本,为什么?
[WARNING] Some problems were encountered while building the effective model for com.example:ex1:jar:0.0.1-SNAPSHOT
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-compiler-plugin is missing. @ line 20, column 12
[WARNING]
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING]
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
我可以理解的这个逻辑,但是:
如果我没有指定maven-compiler-plugin,我会得到一个默认版本,对于maven 3.0.4来说是2.3.2。这意味着在正常情况下,你会得到一些插件的默认版本。
问题:插件的默认版本可以随时间变化吗?我想是这样,例如maven 4.x可能会使用编译器插件的更新的默认版本。
如果是这样的话,那么什么是强迫用户指定版本的优势在哪里?在很多情况下,无论如何,它只会在pom.xml中预见,事先知道将使用哪个maven版本,也就是将使用哪个maven插件版本。
我不明白这背后的逻辑。因此,应该总是强制指定所使用的每个插件的版本(这将非常麻烦)。
确实。这就是为什么我问为什么,你不必总是指定插件版本...如果你不提Maven的编译器插件可言,你随时都有可能得到一个较新的版本... 所以我的问题的本质是不适当的:如果你明确地指定了一个插件,你必须指定版本,但是你不必指定,只需要获得一些默认版本(取决于maven版本)。 我会发现它更逻辑(但繁琐),你必须指定插件版本总是或从不。不仅在某些情况下... – muts