# Unable to import ccr libraries in ism project

**URL:** <https://forum.opensearch.org/t/unable-to-import-ccr-libraries-in-ism-project/18070>\
**Category:** Cross-Cluster Replication\
**Tags:** index-management\
**Created:** [February 25, 2024, 1:56pm UTC](https://forum.opensearch.org/t/unable-to-import-ccr-libraries-in-ism-project/18070 "2024-02-25T13:56:26Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![shivani](https://avatars.discourse-cdn.com/v4/letter/s/ea5d25/32.png) [@shivani](https://forum.opensearch.org/u/shivani)\
**Post date:** [February 25, 2024, 1:56pm UTC](https://forum.opensearch.org/t/unable-to-import-ccr-libraries-in-ism-project/18070/1 "2024-02-25T13:56:26Z")

</div>

**Background** :  
I’m working on an [issue](https://github.com/opensearch-project/index-management/issues/726) 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](https://github.com/opensearch-project/index-management/blob/042f72841ff85032beecc20c3f9338161af2ab42/build.gradle#L232) like this

```auto
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.

 ![image](https://us1.discourse-cdn.com/flex019/uploads/mauve_hedgehog/original/2X/c/c7f495dc7db0479771cb727ea1c9326ad33069a7.png)

**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!

---

<div class="post-metadata">

**Author:** ![shivani](https://avatars.discourse-cdn.com/v4/letter/s/ea5d25/32.png) [@shivani](https://forum.opensearch.org/u/shivani)\
**Post date:** [February 26, 2024, 6:47pm UTC](https://forum.opensearch.org/t/unable-to-import-ccr-libraries-in-ism-project/18070/2 "2024-02-26T18:47:29Z")

</div>

Hi,

PFA - This is my [build.gradle](https://gist.github.com/aggarwalShivani/4c644a897d0668b8955ba4c23cf7e73e) 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.

 ![image](https://us1.discourse-cdn.com/flex019/uploads/mauve_hedgehog/original/2X/3/3b8e77b5a22aa38523c4ca0c95f0934f38a7aaba.png)

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

 ![image](https://us1.discourse-cdn.com/flex019/uploads/mauve_hedgehog/original/2X/f/f559c10ff162d7543e65845d87036ac2a6dabfe3.png)

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.

---

<div class="post-metadata">

**Author:** ![shivani](https://avatars.discourse-cdn.com/v4/letter/s/ea5d25/32.png) [@shivani](https://forum.opensearch.org/u/shivani)\
**Post date:** [February 28, 2024, 6:40pm UTC](https://forum.opensearch.org/t/unable-to-import-ccr-libraries-in-ism-project/18070/3 "2024-02-28T18:40:47Z")

</div>

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).

 ![image](https://us1.discourse-cdn.com/flex019/uploads/mauve_hedgehog/original/2X/7/76a27d553bb2ad38bc10457da9ef84a1da2493db.png)

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.

 ![image](https://us1.discourse-cdn.com/flex019/uploads/mauve_hedgehog/original/2X/4/43d47896e273edda80b052ec9c9b2d091655ddc8.png)

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?

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex019/uploads/mauve_hedgehog/original/2X/3/33547ea01a5b12dcca2958411d3edd97ae2ea8c1.png) [@system](https://forum.opensearch.org/u/system)\
**Post date:** [April 28, 2024, 6:41pm UTC](https://forum.opensearch.org/t/unable-to-import-ccr-libraries-in-ism-project/18070/4 "2024-04-28T18:41:21Z")

</div>

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