Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Records requires ASM8

I want to play around with the newest Java 15 with preview features. I'm using Spring Boot 2.4.0-M2 and Gradle 6.7-rc2, where both of them support Java 15 features.
I want to build a docker image from my project using jib. Here's my jib configuration:

jib {
    from {
        image = 'openjdk:15-jdk'
    }   
    to {
        image = '<username>/<project>'
    }
    container {
        jvmFlags = ['--enable-preview']
    }
}

Unfortunately, when I'm running ./gradlew jib I'm getting the following error:

Execution failed for task ':jib'.
> Records requires ASM8

And here's the output while running with --info flag:

> Task :jib FAILED
Caching disabled for task ':jib' because:
  Build cache is disabled
Task ':jib' is not up-to-date because:
  Task has not declared any outputs despite executing actions.
Searching for main class... Add a 'mainClass' configuration to 'jib' to improve build speed.
Could not find a valid main class from 'jar' task; looking into all class files to infer main class.
:jib (Thread[Execution worker for ':',5,main]) completed. Took 0.003 secs.

Have anyone had a similar problem?

like image 718
Forin Avatar asked Apr 19 '26 05:04

Forin


2 Answers

If you're getting this on Android and you're using Moshi 1.13.0 and Dagger Hilt, add this to your gradle.properties file in the root of your app.

 android.jetifier.ignorelist=moshi-1.13.0

https://github.com/square/moshi/issues/1463#issuecomment-994576201

like image 171
georgiecasey Avatar answered Apr 21 '26 19:04

georgiecasey


Regarding to the error message Could not find a valid main class from 'jar' task the main class is missing for this task. So you must add the main class and the process should work:

mainClassName = "your.MainClass"
like image 32
flaxel Avatar answered Apr 21 '26 18:04

flaxel



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!