Gabriel
Gabriel

Reputation: 9432

How to import java module in Kotlin Gradle script

I would like to import java.lang.module to use https://docs.oracle.com/javase/9/docs/api/java/lang/module/ModuleDescriptor.Version.html

How can I do this in a gradle .kts Kotlin script?

I tried

import java.lang.module

which did not work.

Upvotes: 2

Views: 783

Answers (2)

Ashish
Ashish

Reputation: 1917

Upgrade your Project JDK to JDK 11. Import the Version class directly.

Upvotes: 0

broot
broot

Reputation: 28322

You can't import packages in Java. You need to import a specific class:

import java.lang.module.ModuleDescriptor

Or import all classes from a package:

import java.lang.module.*

It is not really related to Gradle, it is specific to Java/Kotlin.

Upvotes: 3

Related Questions