Rad*_*vic 23 gradle spring-boot
我有一个单独的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'
Run Code Online (Sandbox Code Playgroud)
然后,在另一个项目中,它被引用如下:
apply from: '../../food-orders-online-main/spring-boot.gradle'
Run Code Online (Sandbox Code Playgroud)
当我运行构建任务时,我收到以下错误:
A problem occurred evaluating script.
> Failed to apply plugin [id 'spring-boot']
> Plugin with id 'spring-boot' not found.
Run Code Online (Sandbox Code Playgroud)
有人知道我做错了什么吗?
Mar*_*ira 22
脚本插件不支持通过插件ID应用插件.您必须使用插件的完全限定类名.
apply plugin: org.springframework.boot.gradle.plugin.SpringBootPlugin
Run Code Online (Sandbox Code Playgroud)
有关更多信息,请参阅此主题.
更新:更新插件类名称.
小智 8
这段代码对我有用
plugins{
id 'org.springframework.boot' version '2.0.3.RELEASE'
}
Run Code Online (Sandbox Code Playgroud)
这些是我在spring boot 2.0.1上使用的插件
Run Code Online (Sandbox Code Playgroud)apply plugin: 'java' apply plugin: 'org.springframework.boot' apply plugin: 'io.spring.dependency-management'
我在这里完整的vanilla gradle文件(Spring boot 2.0.5)
buildscript {
ext {
springBootVersion = '2.0.5.RELEASE'
}
repositories {
mavenCentral()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
}
}
apply plugin: 'java'
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'
group = 'com.example'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = 1.8
repositories {
mavenCentral()
}
dependencies {
compile('org.springframework.boot:spring-boot-starter')
testCompile('org.springframework.boot:spring-boot-starter-test')
}
Run Code Online (Sandbox Code Playgroud)
要么
有一个更好的选择,转到spring boot模板生成门户网站start.spring.io并从那里生成一个模板项目,并从那里逐步构建.
小智 6
添加:
buildscript {
repositories {
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath "org.springframework.boot:spring-boot-gradle-plugin:2.0.4.RELEASE"
}}
Run Code Online (Sandbox Code Playgroud)改变:
apply plugin: 'spring-boot'
Run Code Online (Sandbox Code Playgroud)
到:
apply plugin: "org.springframework.boot"
Run Code Online (Sandbox Code Playgroud)| 归档时间: |
|
| 查看次数: |
41137 次 |
| 最近记录: |