Resolving dependencies in Eclipse with Perspective component examples (project type import)

I’m working on a custom Perspective module. My IDE can’t resolve these imports:

import com.inductiveautomation.perspective.gateway.api.ComponentModelDelegateRegistry;
import com.inductiveautomation.perspective.gateway.api.PerspectiveContext;

I added other jar files (such as perspective-common and perspective-designer) to the build path but I can’t find the perspective-gateway api jar in my local Maven repository (installed when I built my Vision components, see pic below). Am I really missing a jar file? Most likely I’m missing something else…suggestions?

image

Thanks again! : )

How are you adding/managing these dependencies?

Hi Kevin, thanks again!

I just realized I have the jar file, somewhere, because my module compiles. I’d bet that the mvn package doesn’t download and cache the perspective-gateway to the .m2 folder because it doesn’t need it for building Vision modules. To answer your question “How are you adding/managing these dependencies?” I’m not…I let gradlew.bat buildModule handle that…guess I need to find out where gradle is caching the jar file. Can’t find it. Or does the gradle build pull what it needs from the nexus repository each time it compiles?

In my IDE I’m adding the dependencies manually, pointing them to local jar files as in the picture below. My gut tells me I’m not answering you correctly or completely. :thinking:

These are contradictory statements…

If you were following the Perspective component example and letting Gradle manage your dependencies you’d have an entry like this in your gateway-scoped module: ignition-sdk-examples/build.gradle at f3ea0381d2875c6bece5fd653ba86871e7326596 · inductiveautomation/ignition-sdk-examples · GitHub

and your IDE should understand you’re working with Gradle and automatically get its dependencies from Gradle, which will download them as necessary.

I have that entry in my gateway-scoped module. I think I’m getting it now. My IDE is Eclipse and I’m new to it so I guess I have to set it up and “tell is something”. I’ll start here and see how far I can get.
https://docs.inductiveautomation.com/display/SE/Setting+up+your+Eclipse+Environment
Thanks again Kevin…I’ll press on and see how far I get.

I’m not sure how much that documentation will help, it’s geared towards Maven and not Gradle. But maybe the setup is similar enough - don’t know, none of us really use Eclipse.

You’re right, it didn’t :slightly
I did figure it out…I didn’t import the example project correctly. I deleted the project from the Eclipse work space and imported it as a Gradle project and voila, all the dependencies are detected and import are resolved. I should rename this post.

Thanks again Kevin, you pointed me in the right direction.

Incorrect
image

Correct
image

2 Likes