My Application consists of multiple Java
modules, built with Gradle
.
I have created a new module within it and I cannot import any classes from the other modules. I am quite new to Gradle/Java so perhaps Im missing something very obvious.
When I attempt to import a class I get the following error:
"Cannot resolve symbol [import class name]"
What can I do to resolve this? Do I need to alter my build.gradle
scripts? Could it be my package structure
?
Note: I am able to import standard java libraries, such as
java.util.HashMap
My Build.gradle is just the following:
apply plugin: 'java'
apply plugin: 'idea'
apply plugin: 'application'
In order to make an import one module into another, you have to provide a module dependencies in your build script. You can read about it in the official documentation here and here.
All you need to do, is to provide defined project structure with the settings.gradle file in the root. And then add the dependencies section to the module, in which you need to import something, like:
dependencies {
compile project(':shared')
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With