我正在尝试逐步实现此处定义的所有指令:
我有一个关于部分的问题: 11.4 Running the example
他们写:
此时我们的申请应该有效 . 由于我们使用了spring-boot-starter-parent POM,因此我们可以使用一个有用的运行目标来启动应用程序 . 键入mvn spring-boot:从根项目目录运行以启动应用程序
我没有直接将spring-boot-maven-plugin添加到我的pom.xml中
我在spring-boot-starter-parent模块中看到spring-boot-maven-plugin仅在 < pluginManagement> section中的pom.xml中定义,这意味着在父模块中只有插件的默认配置描述 .
现在我无法理解 how and where 插件已加载?
1 回答
正如documentation中所述,Maven只是一个插件集合,可以完成项目正确编译所需的所有内容 .
但请注意,您没有明确声明绝大多数 . 例如,Clean插件(删除目标目录)未在您的pom中声明,但如果您键入
mvn clean
,则会加载并执行插件 .它's Maven itself that loads the plugin and it'与
spring-boot-maven-plugin
相同,只要你有这个插件的配置,就像你声明spring-boot-starter-parent
为你的父 .要进一步理解这一点,您可以尝试在this Spring documentation. this Spring documentation.中描述的构建配置
你'll see that if you don'明确包含了spring boot插件,你会收到一个错误"No plugin found for prefix 'spring-boot' in the current project"