Unable to import ccr libraries in ism project

Background:
I’m working on an issue in ISM to add a feature in opensearch index-management plugin. For this, I need to import some classes from opensearch cross-cluster-replication project for the same.
In the ism project, I have added ccr dependency in build.gradle like this

opensearchPlugin "org.opensearch.plugin:opensearch-security:${security_plugin_version}@zip"
opensearchPlugin "org.opensearch.plugin:opensearch-cross-cluster-replication:${ccr_plugin_version}@zip"

Issue:
On running ./gradlew build, it downloads the opensearch-cross-cluster-replication-3.0.0.0-SNAPSHOT.jar under build/tmp/.cache/expanded.
But it does not allow to import classes from this jar in the src code. For ex. import org.opensearch.replication.action.pause does not work and shows unresolved reference.

Expectation: To be able to import classes from ccr project and create request objects for some actions.
How to achieve this? Any helpers will be greatly appreciated!

Hi,

PFA - This is my build.gradle for index-management plugin.
I have tried to ape almost all actions happening with job-scheduler plugin and tried to do the same with ccr plugin. I’ve also tried defining the ccr dependency for compileOnly and implementation, but no luck!

Another thing I’ve noticed : under Project > External Libraries, it does list the cross-cluster-replication jar, but it does not list the classes under this jar.

Meanwhile, for other jars like job-scheduler jar, its underlying classes are clearly visible. For ex. JobDocVersion.java etc.

Questions:

  1. one difference is most of the other jars are java-based code, while ccr is based on kotlin. Could this be a problem?
  2. Could this be related to access modifiers of the ccr classes? Although as per kotlin docs, default access modifier for all classes is public.

Another observation is:
I have tried to import multiple opensearch-plugins that are based on kotlin - mainly, cross-cluster-replication, index-management, alerting -
For all these, under Project > External Libraries > It displays the dependency as a zip. That is not the case for other opensearch plugin dependencies like job-scheduler (java based).

Under the zip, on expanding further, you can see a few .jars like opensearch-cross-cluster-replication-3.0.0.0-SNAPSHOT.jar but not the classes.

This is in contrast to what we see with java based dependencies as shown in my previous comment.
For all these attempted kotlin dependencies, I am unable to import classes in src code and use.

Would highly appreciate any guidance in this area and are there any changes needed in these dependencies projects too?

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.