Closed Bodden007 closed 2 years ago
I have a bunch of questions about the code you provided.
images
on the springBootApplication
extension should be a container image tag and not a list commands.jar
task? The com.bmuschko.docker-spring-boot-application
takes care of it.-s
command line option.application
plugin.This is what I tried:
plugins {
id 'java'
id 'org.springframework.boot' version '2.7.2'
id 'io.spring.dependency-management' version '1.0.14.RELEASE'
id 'com.bmuschko.docker-spring-boot-application' version '8.1.0'
}
docker {
springBootApplication {
baseImage = 'openjdk:18.0.2-jdk-oracle'
images = ['spring-boot:1.0.0']
}
}
version = '1.0.0'
java {
toolchain {
languageVersion = JavaLanguageVersion.of(18)
}
}
repositories {
mavenCentral()
}
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-web'
}
The error message I am see is something else than you are reporting.
Caused by: java.lang.IllegalArgumentException: Unsupported class file major version 62
at com.bmuschko.gradle.docker.shaded.org.objectweb.asm.ClassReader.<init>(ClassReader.java:196)
at com.bmuschko.gradle.docker.shaded.org.objectweb.asm.ClassReader.<init>(ClassReader.java:177)
at com.bmuschko.gradle.docker.shaded.org.objectweb.asm.ClassReader.<init>(ClassReader.java:163)
at com.bmuschko.gradle.docker.shaded.org.objectweb.asm.ClassReader.<init>(ClassReader.java:284)
Is that what you are seeing?. If yes, then we have to upgrade the version of the ASM library that isn't compatible with Java 18 yet.
Это то, что я пробовал:
plugins { id 'java' id 'org.springframework.boot' version '2.7.2' id 'io.spring.dependency-management' version '1.0.14.RELEASE' id 'com.bmuschko.docker-spring-boot-application' version '8.1.0' } docker { springBootApplication { baseImage = 'openjdk:18.0.2-jdk-oracle' images = ['spring-boot:1.0.0'] } } version = '1.0.0' java { toolchain { languageVersion = JavaLanguageVersion.of(18) } } repositories { mavenCentral() } dependencies { implementation 'org.springframework.boot:spring-boot-starter-web' }
Сообщение об ошибке, которое я вижу, - это нечто иное, чем вы сообщаете.
Caused by: java.lang.IllegalArgumentException: Unsupported class file major version 62 at com.bmuschko.gradle.docker.shaded.org.objectweb.asm.ClassReader.<init>(ClassReader.java:196) at com.bmuschko.gradle.docker.shaded.org.objectweb.asm.ClassReader.<init>(ClassReader.java:177) at com.bmuschko.gradle.docker.shaded.org.objectweb.asm.ClassReader.<init>(ClassReader.java:163) at com.bmuschko.gradle.docker.shaded.org.objectweb.asm.ClassReader.<init>(ClassReader.java:284)
Это то, что вы видите?. Если да, то нам нужно обновить версию библиотеки ASM, которая еще не совместима с Java 18.
Thank you, you're right. That's exactly what I see. Can I somehow update the ASM library ?
In this case, you can't upgrade the library as it has been bundled and package-relocated in the plugin JAR. The change will go out with the next release of the plugin: https://github.com/bmuschko/gradle-docker-plugin/pull/1107
Side note: I'd recommend just sticking with Java 17 which is the Long Term Support release of Java. I doubt there's a specific feature or bug fix in Java 18 that you need specifically.
I get it, thanks.
Hello friends. I'm still new to gradle and plugins. When trying to create a new dockerfile, when running the dockerCreateDockerfile task, i get an error. I try to do everything according to: https://bmuschko.github.io/gradle-docker-plugin/current/user-guide/#tasks_2.
`plugins { id 'org.springframework.boot' version '2.7.2' id 'io.spring.dependency-management' version '1.0.12.RELEASE' id 'java' id 'application' id "com.bmuschko.docker-spring-boot-application" version "8.1.0" }
tasks.withType(JavaCompile){ options.encoding = 'UTF-8' }
tasks.jar {
`sourceCompatibility = '18'
repositories { mavenCentral() mavenLocal() }
dependencies { implementation('org.springframework.boot:spring-boot-starter-web') compileOnly group: 'org.projectlombok', name: 'lombok', version: '1.18.24' annotationProcessor 'org.projectlombok:lombok' testImplementation 'org.springframework.boot:spring-boot-starter-test' implementation 'com.vk.api:sdk:1.0.14' implementation group: 'javax.json', name: 'javax.json-api', version: '1.1.4' implementation group: 'org.glassfish', name: 'javax.json', version: '1.1.4' implementation 'com.google.guava:guava:31.1-jre'
}
configurations { all { exclude group: 'org.springframework.boot', module: 'spring-boot-starter-logging' } }
tasks.named('test') { useJUnitPlatform() }`
I get an error:
Unsupported Java. Your build is currently configured to use Java 18.0.2 and Gradle 7.5.1.
`Unsupported Java. Your build is currently configured to use Java 18.0.2 and Gradle 7.5.1.
Possible solution:
distributionUrl
property to use compatible Gradle version and reload the project`I can't understand why they don't want to be friends with cradle + plugin? The project is perfectly assembled in a jar and works.