java - 设置 Spring Native Experimental(在以下任何来源中均未找到 id 'org.springframework.experimental.aot' 版本 '0.10.3')
问题描述
你好女士们先生们,
所以我只是想通过使用 Spring Native 为我的 Spring 应用程序获取可执行文件。
我的 build.gradle:
plugins {
id 'org.springframework.boot' version '2.5.4'
id 'io.spring.dependency-management' version '1.0.10.RELEASE'
id 'java'
id 'org.springframework.experimental.aot' version '0.10.3'
}
group = 'com.example'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '11'
configurations {
compileOnly {
extendsFrom annotationProcessor
}
}
repositories {
mavenCentral()
}
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-data-jpa:2.5.4'
implementation 'org.springframework.boot:spring-boot-starter-web:2.5.4'
compileOnly 'org.projectlombok:lombok:1.18.20'
annotationProcessor 'org.projectlombok:lombok:1.18.20'
testImplementation 'org.springframework.boot:spring-boot-starter-test:2.5.4'
implementation group: 'org.postgresql', name: 'postgresql', version: '42.2.14'
implementation group: 'org.apache.poi', name: 'poi', version: '4.1.2'
implementation group: 'org.apache.poi', name: 'poi-ooxml', version: '4.1.2'
implementation group: 'com.squareup.okhttp3', name: 'okhttp', version: '3.14.6'
implementation group: 'org.json', name: 'json', version: '20180813'
}
test {
useJUnitPlatform()
}
和我的 settings.gradle:
rootProject.name = 'demo'
在将“org.springframework.experimental.aot”版本“0.10.3”插件添加到 build.gradle 后,如上所示(按照 2.1.2 https://docs.spring.io/spring- native/docs/current/reference/htmlsingle/#getting-started),我收到以下错误:
org.gradle.api.plugins.UnknownPluginException: Plugin [id: 'org.springframework.experimental.aot', version: '0.10.3'] was not found in any of the following sources:
- Gradle Core Plugins (plugin is not in 'org.gradle' namespace)
- Plugin Repositories (could not resolve plugin artifact 'org.springframework.experimental.aot:org.springframework.experimental.aot.gradle.plugin:0.10.3')
Searched in the following repositories:
Gradle Central Plugin Repository
解决方案
评论的人是对的,尽管我认为由于教程乱七八糟,我认为这是不必要的粗鲁,并且他们告诉您在向您提供安装说明之前应用该插件。
更具体地说,您需要将 spring release maven repo 添加到您settings.gradle.kts
的插件中以获取插件
pluginManagement {
repositories {
gradlePluginPortal()
maven { url = uri("https://repo.spring.io/release") }
mavenLocal()
}
}
然后还将存储库添加到您build.gradle.kts
的以获取依赖项
repositories {
maven { url = uri("https://repo.spring.io/release") }
}
推荐阅读
- java - 如何以表格格式打印我的数组列表值
- excel - 不同用户的日期排序宏问题
- python - 如何解决 IndexError: list index out of range in a list of dict?
- r - 检查电子邮件列中的名称是否重复
- azure-batch - Azure Batch 作业发布任务未运行
- python - 如何在python中的3维数组中进行连接组件标记?
- java - 是否可以在现代浏览器网页中嵌入 java swing 应用程序?
- c# - 如何使用 Pupeetersharp 从元素中获取计算的样式属性
- python - 使用 rpy2 指定名称中包含点的参数
- powershell - Powershell 自动完成转义特殊字符并使用单引号