3

I am trying to run very basic application as shared on here

I was able to get the build running but it fails at the end with following error:

    [creator]     Paketo BellSoft Liberica Buildpack 9.0.1
    [creator]       unable to find dependency
    [creator]       no valid dependencies for native-image-svm, 8.*, and io.paketo.stacks.tiny in [(jdk, 8.0.312, [io.buildpacks.stacks.bionic io.paketo.stacks.tiny *]) (jre, 8.0.312, [io.buildpacks.stacks.bionic io.paketo.stacks.tiny *]) (jdk, 11.0.13, [io.buildpacks.stacks.bionic io.paketo.stacks.tiny *]) (jre, 11.0.13, [io.buildpacks.stacks.bionic io.paketo.stacks.tiny *]) (native-image-svm, 11.0.13, [io.buildpacks.stacks.bionic io.paketo.stacks.tiny *]) (jdk, 17.0.1, [io.buildpacks.stacks.bionic io.paketo.stacks.tiny *]) (jre, 17.0.1, [io.buildpacks.stacks.bionic io.paketo.stacks.tiny *]) (native-image-svm, 17.0.1, [io.buildpacks.stacks.bionic io.paketo.stacks.tiny *])]
    [creator]     ERROR: failed to build: exit status 1

Here's my build.gradle :

plugins {
        id 'org.springframework.boot' version '2.6.2'
        id 'io.spring.dependency-management' version '1.0.11.RELEASE'
        id 'java'
        id 'org.springframework.experimental.aot' version '0.11.1'
}

group = 'com.example'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '1.8'


repositories {
        mavenCentral()
        maven { url 'https://repo.spring.io/release' }

}

dependencies {
        implementation 'org.springframework.boot:spring-boot-starter-web'
        testImplementation('org.springframework.boot:spring-boot-starter-test')
}

test {
        useJUnitPlatform()
}

bootBuildImage {
    builder = "paketobuildpacks/builder:tiny"
    environment = [
        "BP_NATIVE_IMAGE" : "true"
    ]
    buildpacks = ["gcr.io/paketo-buildpacks/java-native-image:7.1.0"]
}

I will appreciate any help to fix the issue.

Sukhmeet Sethi
  • 616
  • 5
  • 14

1 Answers1

8

So I managed to solve it. The source compatibility was set to 1.8 and perhaps Java 8 is not compatible with paketo buildback.

Upgrading sourceCompatibility in build.gradle to 11 or 17 fixes the issue:

sourceCompatibility = '11'

// or

sourceCompatibility = '17'
blacktide
  • 10,654
  • 8
  • 33
  • 53
Sukhmeet Sethi
  • 616
  • 5
  • 14