Perpective Component Module Maven Build Example

Hello,

I intend to create a perspective component which contains some text fields as the input and there will be a function in the gateway scope which accepts these input from the perspective component as params to run its application.

I looked at the examples of gateway scope and perspective component from the github examples.
The former example uses maven build while the later seems to be using gradle build tool.

I am not familiar with gradle build tool. Is there any way to build the perspective component using Maven build?
If so could you help me with an example?

1 Like

I don't think the situation has changed, or will change, since Paul made this statement:

If you want to pioneer a path forward with Maven and share it with the community that's fine, but we don't have any examples to help you.

1 Like

Thanks for the information.
Well, just another query, As i have mentioned above, the perspective component will pass the inputs as parameters to a gateway scope function and it is a single module functionality, is it that even the gateway scope should be built using gradle? i mean, should all the scopes present with the perspective component should be using gradle only?

I apologize if the question is too simple.

Put directly, I'm not sure you understand what's happening well enough to even ask the right questions.

Outside of Perspective, which has extra complications because it involves a different language (JavaScript), you're welcome to build an Ignition module in whatever JVM language you want using whatever build tool you want. @pturmel uses/used Ant, for instance. All Ignition, the platform, cares about is whether it gets a properly formatted .modl file - which is just a zip, containing .jar files with the code and dependencies you want to provide and a properly structured module.xml file.
How you bundle your dependencies and code is entirely irrelevant to Ignition. We provide Maven and Gradle module plugins to make things easier, but they're not required.

If you want to make a scripting function (I can't really tell what you mean by "a function in the gateway scope" besides a scripting function), it's extremely easy to simply copy the code in the scripting function example into the Perspective example. A module's gateway hook can do any number of things; it's not like there's any restriction that says a module must only do one or the other thing. We even have a Gradle-ified example of the scripting function available in a different repo: ignition-sdk-training/scripting-function-g at main · inductiveautomation/ignition-sdk-training · GitHub

All that said, you probably don't actually need a scripting function at all? If you want your Perspective component to be able to run some arbitrary Java code on demand, you can already do that - the component model for Perspective supports arbitrary 'Delegate' registration, such that we will create an instance of a Java class for you, in sync with the component lifecycle on the frontend, and expose whatever script callable methods you want, or add component message hooks that your frontend code can fire.

3 Likes

I can speak from experience, it is about 1,000,000,000 times easier to use the existing Gradle libraries than trying to convert over to using maven. I spent weeks of time in the process of converting it over to using maven but it was a headache. It was much easier to use the Gradle version.

2 Likes