Module with Perspective Component Dependencies

I'm trying to set up a module with the perspective dependencies, but getting the following error:

The import com.inductiveautomation.perspective cannot be resolved

In my build.gradle.kts file, I've included the module dependencies as follow

moduleDependencies = mapOf(
      "GD" to "com.inductiveautomation.perspective"
  )

And in my common scope build.gradle.kts file I've also included the following

dependencies {
    // add common scoped dependencies here
    compileOnly("com.inductiveautomation.ignitionsdk:ignition-common:${rootProject.extra["sdk_version"]}")
    compileOnly("com.inductiveautomation.ignitionsdk:perspective-common:${rootProject.extra["sdk_version"]}")
}

Everything else in my build.gradle.kts file and settings.gradle file is generated by defaulted when creating the module project using gradle build tool. Am I missing anything?

Where are you getting that error? In your IDE?

Yup, I'm using VSCode

Okay, so where is the file you're editing where you're getting that error?
compileOnly dependencies, even of a Gradle subproject that's pulled in by another subproject, are not shared - so you would need to redeclare these common scoped dependencies in e.g. gateway if you were authoring a Java file in gateway; e.g:

The file is located in common scope folder

:man_shrugging: I don't use VSCode so I can't advise much more than broad strokes.
In IntelliJ, you have to sometimes update the IDE's internal 'model' of the project to sync it up with Gradle's model of the project. Can you build via the command line, independent of VSC, or does it throw the same error? That would help isolate the nature of the problem.

You're right, it seems to be an ide issue with problem detecting the dependencies. Things seem to be working now after running ./gradlew --refresh-dependencies and triggering the reload window command in vscode.

Thanks for your time!

1 Like