tdo*_*dog 3 java spring gradle spring-boot spring-native
女士们先生们大家好,
所以我只是想通过使用 Spring Native 为我的 Spring 应用程序获取可执行文件。
我的构建.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()
}
Run Code Online (Sandbox Code Playgroud)
和我的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
Run Code Online (Sandbox Code Playgroud)
Rya*_*ink 13
发表评论的人是对的,尽管我认为鉴于教程乱七八糟,他们没有必要粗鲁,并且他们告诉您在向您提供如何安装的说明之前应用该插件。
更具体地说,您需要将 spring 发行版 Maven 存储库添加到您的源中settings.gradle.kts,以便获取该插件
pluginManagement {
repositories {
gradlePluginPortal()
maven { url = uri("https://repo.spring.io/release") }
mavenLocal()
}
}
Run Code Online (Sandbox Code Playgroud)
然后还将存储库添加到您的存储库中build.gradle.kts以获取依赖项
repositories {
maven { url = uri("https://repo.spring.io/release") }
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3488 次 |
| 最近记录: |