3

Hello ladies and gentlemen,

so i was just trying to get a executable for my Spring application by using Spring Native.

My 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()
}

and my settings.gradle: rootProject.name = 'demo'

after adding the 'org.springframework.experimental.aot' version '0.10.3' plugin to the build.gradle as seen above (doing whats told in the documentary under 2.1.2 https://docs.spring.io/spring-native/docs/current/reference/htmlsingle/#getting-started), i get following error:

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
tdog
  • 27
  • 1
  • 5
  • 1
    When following a tutorial, do follow the tutorial and don't skip steps. You forgot https://docs.spring.io/spring-native/docs/current/reference/htmlsingle/#_maven_repository (adding the repository). – M. Deinum Sep 20 '21 at 14:17

1 Answers1

13

The person who commented is right, though I think unnecessarily rude given that the tutorial is out of order, and they tell you to apply the plugin prior to giving you instructions how to install.

More specifically, you need to add the spring release maven repo to your settings.gradle.kts in order to source the plugin

pluginManagement {
  repositories {
    gradlePluginPortal()
    maven { url = uri("https://repo.spring.io/release") }
    mavenLocal()
  }
}

and then also add the repository to your build.gradle.kts in order to source the dependencies

repositories {
  maven { url = uri("https://repo.spring.io/release") }
}
Ryan Brink
  • 209
  • 2
  • 6