Skip to main content
 首页 » 编程设计

gradle之找不到spring-boot gradle插件

2025年01月19日37xiaohuochai

我有一个单独的gradle脚本,只是添加了spring-boot插件。看起来像这样:

buildscript { 
    repositories { 
        mavenLocal() 
        mavenCentral() 
        maven { url 'http://repo.spring.io/libs-release' } 
    } 
    dependencies { 
        classpath 'org.springframework.boot:spring-boot-gradle-plugin:1.1.8.RELEASE' 
    } 
} 
 
apply plugin: 'spring-boot' 

然后,在另一个项目中,像这样引用它:
apply from: '../../food-orders-online-main/spring-boot.gradle' 

运行构建任务时,出现以下错误:
A problem occurred evaluating script. 
> Failed to apply plugin [id 'spring-boot'] 
> Plugin with id 'spring-boot' not found. 

有人知道我在做什么错吗?

请您参考如下方法:

脚本插件不支持按插件ID应用插件。您必须使用插件的完全限定的类名。

apply plugin: org.springframework.boot.gradle.plugin.SpringBootPlugin 

有关更多信息,请参见 this thread

更新:更新插件类名称。