# How to debug elasticsearch plugin using eclipse

**URL:** <https://discuss.elastic.co/t/how-to-debug-elasticsearch-plugin-using-eclipse/11551>\
**Category:** Elasticsearch\
**Created:** [April 11, 2013, 2:51pm UTC](https://discuss.elastic.co/t/how-to-debug-elasticsearch-plugin-using-eclipse/11551 "2013-04-11T14:51:36Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![kiruba](https://avatars.discourse-cdn.com/v4/letter/k/73ab20/32.png) [@kiruba](https://discuss.elastic.co/u/kiruba)\
**Post date:** [April 11, 2013, 2:51pm UTC](https://discuss.elastic.co/t/how-to-debug-elasticsearch-plugin-using-eclipse/11551/1 "2013-04-11T14:51:36Z")

</div>

Hi all,

```
    i need to debug elasticsearch plugin from eclipse IDE. how can i 

```

do this? i searched lot but didn't get any solution. can any one tell me  
how to configure debugging for elasticsearch plugin.

_note:_ i learned how to create elasticsearch plugin from this site  
[http://jfarrell.github.io/](http://jfarrell.github.io/)

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [April 11, 2013, 2:54pm UTC](https://discuss.elastic.co/t/how-to-debug-elasticsearch-plugin-using-eclipse/11551/2 "2013-04-11T14:54:33Z")

</div>

I would say:

Create a JUnit test or a main().  
Launch it in debug mode.

As you plugin is in the class path, it will be loaded by Elasticsearch.

Here is an example of tests I write for my own plugins: [https://github.com/dadoonet/fsriver/blob/master/src/test/java/org/elasticsearch/river/fs/FsRiverFileSizeDisabledTest.java](https://github.com/dadoonet/fsriver/blob/master/src/test/java/org/elasticsearch/river/fs/FsRiverFileSizeDisabledTest.java)

## HTH

David Pilato | Technical Advocate | [Elasticsearch.com](http://Elasticsearch.com)  
@dadoonet | @elasticsearchfr | @scrutmydocs

Le 11 avr. 2013 à 16:51, kiruba karan [rkiruba.k@gmail.com](mailto:rkiruba.k@gmail.com) a écrit :

> Hi all,
> 
> ```
> i need to debug elasticsearch plugin from eclipse IDE. how can i do this? i searched lot but didn't get any solution. can any one tell me how to configure debugging for elasticsearch plugin. 
> 
> ```
> 
> note: i learned how to create elasticsearch plugin from this site [http://jfarrell.github.io/](http://jfarrell.github.io/)
> 
> --  
> You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
> To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Igor\_Motov](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/igor_motov/32/45193_2.png) [@Igor\_Motov](https://discuss.elastic.co/u/Igor_Motov)\
**Post date:** [April 12, 2013, 5:23pm UTC](https://discuss.elastic.co/t/how-to-debug-elasticsearch-plugin-using-eclipse/11551/3 "2013-04-12T17:23:56Z")

</div>

Unit test is definitely the way to go. But if you want to start  
elasticsearch with your plugin loaded, just start  
org.elasticsearch.bootstrap.Bootstrap as the main class and add  
-Des.foreground=true as VM parameter.

On Thursday, April 11, 2013 10:54:33 AM UTC-4, David Pilato wrote:

> I would say:
> 
> Create a JUnit test or a main().  
> Launch it in debug mode.
> 
> As you plugin is in the class path, it will be loaded by Elasticsearch.
> 
> Here is an example of tests I write for my own plugins:  
> [https://github.com/dadoonet/fsriver/blob/master/src/test/java/org/elasticsearch/river/fs/FsRiverFileSizeDisabledTest.java](https://github.com/dadoonet/fsriver/blob/master/src/test/java/org/elasticsearch/river/fs/FsRiverFileSizeDisabledTest.java)
> 
> ## HTH
> 
> _David Pilato_ | _Technical Advocate_ | _[Elasticsearch.com](http://Elasticsearch.com)_  
> @dadoonet [https://twitter.com/dadoonet](https://twitter.com/dadoonet) | @elasticsearchfr[https://twitter.com/elasticsearchfr](https://twitter.com/elasticsearchfr)  
> | @scrutmydocs [https://twitter.com/scrutmydocs](https://twitter.com/scrutmydocs)
> 
> Le 11 avr. 2013 à 16:51, kiruba karan \<[rkir...@gmail.com](mailto:rkir...@gmail.com) \<javascript:\>\> a  
> écrit :
> 
> Hi all,
> 
> ```
> i need to debug elasticsearch plugin from eclipse IDE. how can i 
> 
> ```
> 
> do this? i searched lot but didn't get any solution. can any one tell me  
> how to configure debugging for elasticsearch plugin.
> 
> _note:_ i learned how to create elasticsearch plugin from this site  
> [http://jfarrell.github.io/](http://jfarrell.github.io/)
> 
> --  
> You received this message because you are subscribed to the Google Groups  
> "elasticsearch" group.  
> To unsubscribe from this group and stop receiving emails from it, send an  
> email to [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com) \<javascript:\>.  
> For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Matt\_Sullivan](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/matt_sullivan/32/2016_2.png) [@Matt\_Sullivan](https://discuss.elastic.co/u/Matt_Sullivan)\
**Post date:** [October 23, 2013, 12:55am UTC](https://discuss.elastic.co/t/how-to-debug-elasticsearch-plugin-using-eclipse/11551/4 "2013-10-23T00:55:56Z")

</div>

I am having trouble trying to debug my elasticsearch plugin via eclipse.

I can build my plugin fine, and install it to a version of Elasticsearch i  
built on my machine.

But its not working properly...

In order to debug my plugin, I am trying to run unit tests (via eclipse  
jUnit), but it is obvious from the errors being thrown in my test that my  
plugin is not installed in the version of elasticsearch my tests are  
running against

In my workspace i have imported my plugin's folder/ and a checkout of the  
latest version of Elasticsearch

What is the proper setup to get my plugin to be installed into  
elasticsearch, and still be able to debug it (I am not touching the  
Elasticsearch source code, i have it important as a point of reference and  
figured it would be good practice to build it on my own).

-matto

On Friday, April 12, 2013 1:23:56 PM UTC-4, Igor Motov wrote:

> Unit test is definitely the way to go. But if you want to start  
> elasticsearch with your plugin loaded, just start  
> org.elasticsearch.bootstrap.Bootstrap as the main class and add  
> -Des.foreground=true as VM parameter.
> 
> On Thursday, April 11, 2013 10:54:33 AM UTC-4, David Pilato wrote:
> 
> > I would say:
> > 
> > Create a JUnit test or a main().  
> > Launch it in debug mode.
> > 
> > As you plugin is in the class path, it will be loaded by Elasticsearch.
> > 
> > Here is an example of tests I write for my own plugins:  
> > [https://github.com/dadoonet/fsriver/blob/master/src/test/java/org/elasticsearch/river/fs/FsRiverFileSizeDisabledTest.java](https://github.com/dadoonet/fsriver/blob/master/src/test/java/org/elasticsearch/river/fs/FsRiverFileSizeDisabledTest.java)
> > 
> > ## HTH
> > 
> > _David Pilato_ | _Technical Advocate_ | _[Elasticsearch.com](http://Elasticsearch.com)_  
> > @dadoonet [https://twitter.com/dadoonet](https://twitter.com/dadoonet) | @elasticsearchfr[https://twitter.com/elasticsearchfr](https://twitter.com/elasticsearchfr)  
> > | @scrutmydocs [https://twitter.com/scrutmydocs](https://twitter.com/scrutmydocs)
> > 
> > Le 11 avr. 2013 à 16:51, kiruba karan [rkir...@gmail.com](mailto:rkir...@gmail.com) a écrit :
> > 
> > Hi all,
> > 
> > ```
> > i need to debug elasticsearch plugin from eclipse IDE. how can i 
> > 
> > ```
> > 
> > do this? i searched lot but didn't get any solution. can any one tell me  
> > how to configure debugging for elasticsearch plugin.
> > 
> > _note:_ i learned how to create elasticsearch plugin from this site  
> > [http://jfarrell.github.io/](http://jfarrell.github.io/)
> > 
> > --  
> > You received this message because you are subscribed to the Google Groups  
> > "elasticsearch" group.  
> > To unsubscribe from this group and stop receiving emails from it, send an  
> > email to [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com).  
> > For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Igor\_Motov](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/igor_motov/32/45193_2.png) [@Igor\_Motov](https://discuss.elastic.co/u/Igor_Motov)\
**Post date:** [October 23, 2013, 7:00pm UTC](https://discuss.elastic.co/t/how-to-debug-elasticsearch-plugin-using-eclipse/11551/5 "2013-10-23T19:00:31Z")

</div>

Hi Matt,

In case of unit tests, for the plugin to be loaded, it's enough for it to  
be in Elasticsearch classpath. In general plugin loading is done in two  
main steps.  
First, jar files in the plugins directory are added to class path. This is  
irrelevant step in your case since your plugin is already in class path.  
Once all jars are added to the class path, Elasticsearch searches class  
path for files called es-plugin.properties and creates new instances of  
the Plugin class that "plugin" property of es-plugin.properties file is  
pointing to. So, make sure that you have es-plugin.properties file in path  
an that it points to the right class and that an object of this class is  
getting instantiated. When plugin object is instantiated Elasticsearch  
starts interacting with different plugin methods such as giving it access  
to modules, via onModule and processModule methods, loading module from  
plugin itself, starting plugin's services, etc.

Igor

On Tuesday, October 22, 2013 8:55:56 PM UTC-4, Matt Sullivan wrote:

> I am having trouble trying to debug my elasticsearch plugin via eclipse.
> 
> I can build my plugin fine, and install it to a version of Elasticsearch  
> i built on my machine.
> 
> But its not working properly...
> 
> In order to debug my plugin, I am trying to run unit tests (via eclipse  
> jUnit), but it is obvious from the errors being thrown in my test that my  
> plugin is not installed in the version of elasticsearch my tests are  
> running against
> 
> In my workspace i have imported my plugin's folder/ and a checkout of the  
> latest version of Elasticsearch
> 
> What is the proper setup to get my plugin to be installed into  
> elasticsearch, and still be able to debug it (I am not touching the  
> Elasticsearch source code, i have it important as a point of reference and  
> figured it would be good practice to build it on my own).
> 
> -matto
> 
> On Friday, April 12, 2013 1:23:56 PM UTC-4, Igor Motov wrote:
> 
> > Unit test is definitely the way to go. But if you want to start  
> > elasticsearch with your plugin loaded, just start  
> > org.elasticsearch.bootstrap.Bootstrap as the main class and add  
> > -Des.foreground=true as VM parameter.
> > 
> > On Thursday, April 11, 2013 10:54:33 AM UTC-4, David Pilato wrote:
> > 
> > > I would say:
> > > 
> > > Create a JUnit test or a main().  
> > > Launch it in debug mode.
> > > 
> > > As you plugin is in the class path, it will be loaded by Elasticsearch.
> > > 
> > > Here is an example of tests I write for my own plugins:  
> > > [https://github.com/dadoonet/fsriver/blob/master/src/test/java/org/elasticsearch/river/fs/FsRiverFileSizeDisabledTest.java](https://github.com/dadoonet/fsriver/blob/master/src/test/java/org/elasticsearch/river/fs/FsRiverFileSizeDisabledTest.java)
> > > 
> > > ## HTH
> > > 
> > > _David Pilato_ | _Technical Advocate_ | _[Elasticsearch.com](http://Elasticsearch.com)_  
> > > @dadoonet [https://twitter.com/dadoonet](https://twitter.com/dadoonet) | @elasticsearchfr[https://twitter.com/elasticsearchfr](https://twitter.com/elasticsearchfr)  
> > > | @scrutmydocs [https://twitter.com/scrutmydocs](https://twitter.com/scrutmydocs)
> > > 
> > > Le 11 avr. 2013 à 16:51, kiruba karan [rkir...@gmail.com](mailto:rkir...@gmail.com) a écrit :
> > > 
> > > Hi all,
> > > 
> > > ```
> > > i need to debug elasticsearch plugin from eclipse IDE. how can 
> > > 
> > > ```
> > > 
> > > i do this? i searched lot but didn't get any solution. can any one tell me  
> > > how to configure debugging for elasticsearch plugin.
> > > 
> > > _note:_ i learned how to create elasticsearch plugin from this site  
> > > [http://jfarrell.github.io/](http://jfarrell.github.io/)
> > > 
> > > --  
> > > You received this message because you are subscribed to the Google  
> > > Groups "elasticsearch" group.  
> > > To unsubscribe from this group and stop receiving emails from it, send  
> > > an email to [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com).  
> > > For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Matt\_Sullivan](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/matt_sullivan/32/2016_2.png) [@Matt\_Sullivan](https://discuss.elastic.co/u/Matt_Sullivan)\
**Post date:** [October 26, 2013, 2:55pm UTC](https://discuss.elastic.co/t/how-to-debug-elasticsearch-plugin-using-eclipse/11551/6 "2013-10-26T14:55:10Z")

</div>

Igor,  
Thanks for the help. I guess where I am confused is... I working (in  
Eclipse) in the folder of my plugin, with elasticsearch listed as a maven  
dependency in the pom.xml file. I am trying to run my JUnit tests from  
that spot, and it seems that even with a es-plugin.properties pointing to  
my plugin, its not being picked up. In this case, the elasticsearch code  
is available for me to build, but I assume the plugin is not being picked  
up because elasticsearch is never being run??

Should I instead have a project setup where I am in the source for elastic  
search, and I have imported my plugin folder to that projects classpath?

Hope that makes sense

-Matt

On Wednesday, October 23, 2013 3:00:31 PM UTC-4, Igor Motov wrote:

> Hi Matt,
> 
> In case of unit tests, for the plugin to be loaded, it's enough for it to  
> be in Elasticsearch classpath. In general plugin loading is done in two  
> main steps.  
> First, jar files in the plugins directory are added to class path. This is  
> irrelevant step in your case since your plugin is already in class path.  
> Once all jars are added to the class path, Elasticsearch searches class  
> path for files called es-plugin.properties and creates new instances of  
> the Plugin class that "plugin" property of es-plugin.properties file is  
> pointing to. So, make sure that you have es-plugin.properties file in path  
> an that it points to the right class and that an object of this class is  
> getting instantiated. When plugin object is instantiated Elasticsearch  
> starts interacting with different plugin methods such as giving it access  
> to modules, via onModule and processModule methods, loading module from  
> plugin itself, starting plugin's services, etc.
> 
> Igor
> 
> On Tuesday, October 22, 2013 8:55:56 PM UTC-4, Matt Sullivan wrote:
> 
> > I am having trouble trying to debug my elasticsearch plugin via eclipse.
> > 
> > I can build my plugin fine, and install it to a version of Elasticsearch  
> > i built on my machine.
> > 
> > But its not working properly...
> > 
> > In order to debug my plugin, I am trying to run unit tests (via eclipse  
> > jUnit), but it is obvious from the errors being thrown in my test that my  
> > plugin is not installed in the version of elasticsearch my tests are  
> > running against
> > 
> > In my workspace i have imported my plugin's folder/ and a checkout of the  
> > latest version of Elasticsearch
> > 
> > What is the proper setup to get my plugin to be installed into  
> > elasticsearch, and still be able to debug it (I am not touching the  
> > Elasticsearch source code, i have it important as a point of reference and  
> > figured it would be good practice to build it on my own).
> > 
> > -matto
> > 
> > On Friday, April 12, 2013 1:23:56 PM UTC-4, Igor Motov wrote:
> > 
> > > Unit test is definitely the way to go. But if you want to start  
> > > elasticsearch with your plugin loaded, just start  
> > > org.elasticsearch.bootstrap.Bootstrap as the main class and add  
> > > -Des.foreground=true as VM parameter.
> > > 
> > > On Thursday, April 11, 2013 10:54:33 AM UTC-4, David Pilato wrote:
> > > 
> > > > I would say:
> > > > 
> > > > Create a JUnit test or a main().  
> > > > Launch it in debug mode.
> > > > 
> > > > As you plugin is in the class path, it will be loaded by Elasticsearch.
> > > > 
> > > > Here is an example of tests I write for my own plugins:  
> > > > [https://github.com/dadoonet/fsriver/blob/master/src/test/java/org/elasticsearch/river/fs/FsRiverFileSizeDisabledTest.java](https://github.com/dadoonet/fsriver/blob/master/src/test/java/org/elasticsearch/river/fs/FsRiverFileSizeDisabledTest.java)
> > > > 
> > > > ## HTH
> > > > 
> > > > _David Pilato_ | _Technical Advocate_ | _[Elasticsearch.com](http://Elasticsearch.com)_  
> > > > @dadoonet [https://twitter.com/dadoonet](https://twitter.com/dadoonet) | @elasticsearchfr[https://twitter.com/elasticsearchfr](https://twitter.com/elasticsearchfr)  
> > > > | @scrutmydocs [https://twitter.com/scrutmydocs](https://twitter.com/scrutmydocs)
> > > > 
> > > > Le 11 avr. 2013 à 16:51, kiruba karan [rkir...@gmail.com](mailto:rkir...@gmail.com) a écrit :
> > > > 
> > > > Hi all,
> > > > 
> > > > ```
> > > > i need to debug elasticsearch plugin from eclipse IDE. how can 
> > > > 
> > > > ```
> > > > 
> > > > i do this? i searched lot but didn't get any solution. can any one tell me  
> > > > how to configure debugging for elasticsearch plugin.
> > > > 
> > > > _note:_ i learned how to create elasticsearch plugin from this site  
> > > > [http://jfarrell.github.io/](http://jfarrell.github.io/)
> > > > 
> > > > --  
> > > > You received this message because you are subscribed to the Google  
> > > > Groups "elasticsearch" group.  
> > > > To unsubscribe from this group and stop receiving emails from it, send  
> > > > an email to [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com).  
> > > > For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Matt\_Sullivan](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/matt_sullivan/32/2016_2.png) [@Matt\_Sullivan](https://discuss.elastic.co/u/Matt_Sullivan)\
**Post date:** [October 26, 2013, 3:42pm UTC](https://discuss.elastic.co/t/how-to-debug-elasticsearch-plugin-using-eclipse/11551/7 "2013-10-26T15:42:21Z")

</div>

Just tried coming at it from elasticsearch to no avail. Trying my best  
to understand how to keep my plugin code separate from elasticsearch code.

If i import the elasticsearch maven project into eclipse, and then import  
my plugin, they get imported as siblings in the workspace.

If i try to add my plugins folder to the source path from the properties  
build path, it only allows my to chose folders that are subfolders of the  
Elasticsearch code.

-matt

On Saturday, October 26, 2013 10:55:10 AM UTC-4, Matt Sullivan wrote:

> Igor,  
> Thanks for the help. I guess where I am confused is... I working (in  
> Eclipse) in the folder of my plugin, with elasticsearch listed as a maven  
> dependency in the pom.xml file. I am trying to run my JUnit tests from  
> that spot, and it seems that even with a es-plugin.properties pointing to  
> my plugin, its not being picked up. In this case, the elasticsearch code  
> is available for me to build, but I assume the plugin is not being picked  
> up because elasticsearch is never being run??
> 
> Should I instead have a project setup where I am in the source for elastic  
> search, and I have imported my plugin folder to that projects classpath?
> 
> Hope that makes sense
> 
> -Matt
> 
> On Wednesday, October 23, 2013 3:00:31 PM UTC-4, Igor Motov wrote:
> 
> > Hi Matt,
> > 
> > In case of unit tests, for the plugin to be loaded, it's enough for it to  
> > be in Elasticsearch classpath. In general plugin loading is done in two  
> > main steps.  
> > First, jar files in the plugins directory are added to class path. This  
> > is irrelevant step in your case since your plugin is already in class path.  
> > Once all jars are added to the class path, Elasticsearch searches class  
> > path for files called es-plugin.properties and creates new instances of  
> > the Plugin class that "plugin" property of es-plugin.properties file is  
> > pointing to. So, make sure that you have es-plugin.properties file in path  
> > an that it points to the right class and that an object of this class is  
> > getting instantiated. When plugin object is instantiated Elasticsearch  
> > starts interacting with different plugin methods such as giving it access  
> > to modules, via onModule and processModule methods, loading module from  
> > plugin itself, starting plugin's services, etc.
> > 
> > Igor
> > 
> > On Tuesday, October 22, 2013 8:55:56 PM UTC-4, Matt Sullivan wrote:
> > 
> > > I am having trouble trying to debug my elasticsearch plugin via eclipse.
> > > 
> > > I can build my plugin fine, and install it to a version of elastic  
> > > search i built on my machine.
> > > 
> > > But its not working properly...
> > > 
> > > In order to debug my plugin, I am trying to run unit tests (via eclipse  
> > > jUnit), but it is obvious from the errors being thrown in my test that my  
> > > plugin is not installed in the version of elasticsearch my tests are  
> > > running against
> > > 
> > > In my workspace i have imported my plugin's folder/ and a checkout of  
> > > the latest version of Elasticsearch
> > > 
> > > What is the proper setup to get my plugin to be installed into  
> > > elasticsearch, and still be able to debug it (I am not touching the  
> > > Elasticsearch source code, i have it important as a point of reference and  
> > > figured it would be good practice to build it on my own).
> > > 
> > > -matto
> > > 
> > > On Friday, April 12, 2013 1:23:56 PM UTC-4, Igor Motov wrote:
> > > 
> > > > Unit test is definitely the way to go. But if you want to start  
> > > > elasticsearch with your plugin loaded, just start  
> > > > org.elasticsearch.bootstrap.Bootstrap as the main class and add  
> > > > -Des.foreground=true as VM parameter.
> > > > 
> > > > On Thursday, April 11, 2013 10:54:33 AM UTC-4, David Pilato wrote:
> > > > 
> > > > > I would say:
> > > > > 
> > > > > Create a JUnit test or a main().  
> > > > > Launch it in debug mode.
> > > > > 
> > > > > As you plugin is in the class path, it will be loaded by Elasticsearch.
> > > > > 
> > > > > Here is an example of tests I write for my own plugins:  
> > > > > [https://github.com/dadoonet/fsriver/blob/master/src/test/java/org/elasticsearch/river/fs/FsRiverFileSizeDisabledTest.java](https://github.com/dadoonet/fsriver/blob/master/src/test/java/org/elasticsearch/river/fs/FsRiverFileSizeDisabledTest.java)
> > > > > 
> > > > > ## HTH
> > > > > 
> > > > > _David Pilato_ | _Technical Advocate_ | _[Elasticsearch.com](http://Elasticsearch.com)_  
> > > > > @dadoonet [https://twitter.com/dadoonet](https://twitter.com/dadoonet) | @elasticsearchfr[https://twitter.com/elasticsearchfr](https://twitter.com/elasticsearchfr)  
> > > > > | @scrutmydocs [https://twitter.com/scrutmydocs](https://twitter.com/scrutmydocs)
> > > > > 
> > > > > Le 11 avr. 2013 à 16:51, kiruba karan [rkir...@gmail.com](mailto:rkir...@gmail.com) a écrit :
> > > > > 
> > > > > Hi all,
> > > > > 
> > > > > ```
> > > > > i need to debug elasticsearch plugin from eclipse IDE. how 
> > > > > 
> > > > > ```
> > > > > 
> > > > > can i do this? i searched lot but didn't get any solution. can any one tell  
> > > > > me how to configure debugging for elasticsearch plugin.
> > > > > 
> > > > > _note:_ i learned how to create elasticsearch plugin from this site  
> > > > > [http://jfarrell.github.io/](http://jfarrell.github.io/)
> > > > > 
> > > > > --  
> > > > > You received this message because you are subscribed to the Google  
> > > > > Groups "elasticsearch" group.  
> > > > > To unsubscribe from this group and stop receiving emails from it, send  
> > > > > an email to [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com).  
> > > > > For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Igor\_Motov](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/igor_motov/32/45193_2.png) [@Igor\_Motov](https://discuss.elastic.co/u/Igor_Motov)\
**Post date:** [October 27, 2013, 1:13am UTC](https://discuss.elastic.co/t/how-to-debug-elasticsearch-plugin-using-eclipse/11551/8 "2013-10-27T01:13:13Z")

</div>

Hi Matt,

I typically use IntelliJ for Java development, but I just downloaded the  
latest version of Eclipse and tried to perform the following steps with one  
of my plugin projects:

- Started eclipse to create workspace

- In command line, I had to run it since I had new workspace:  
$ mvn -Declipse.workspace= eclipse:add-maven-repo

- Restarted eclipse

- Back in command line in temp directory, cloned my project  
$ git clone [git@github.com](mailto:git@github.com):imotov/elasticsearch-native-script-example.git  
$ cd elasticsearch-native-script-example  
$ mvn eclipse:eclipse

- Back in eclipse:

- Selected File-\>Import...-\>General-\>Existing Project into Workspace-\>Next

- In the Select root directory window selected  
path-to-elasticsearch-native-script-example, Pressed Finish

- Selected Run-\>Run Configurations...-\>Select Java Application-\>Pressed New  
Button

- In the Project window selected elasticsearch-native-script-example

- In the Main class window selected org.elasticsearch.bootstrap.Bootstrap

- Clicked on Arguments tab

- In the VM arguments window typed -Des.foreground=true

- Clicked Run

- Back in command line, verified that plugin is indeed loaded and  
functional:  
$ cd example  
$ sh lookup.sh

So, I think if a plugin project is setup correctly everything works fine in  
eclipse. I hope this example will help.

Igor

On Saturday, October 26, 2013 11:42:21 AM UTC-4, Matt Sullivan wrote:

> Just tried coming at it from elasticsearch to no avail. Trying my best  
> to understand how to keep my plugin code separate from elasticsearch code.
> 
> If i import the elasticsearch maven project into eclipse, and then import  
> my plugin, they get imported as siblings in the workspace.
> 
> If i try to add my plugins folder to the source path from the properties  
> build path, it only allows my to chose folders that are subfolders of the  
> Elasticsearch code.
> 
> -matt
> 
> On Saturday, October 26, 2013 10:55:10 AM UTC-4, Matt Sullivan wrote:
> 
> > Igor,  
> > Thanks for the help. I guess where I am confused is... I working (in  
> > Eclipse) in the folder of my plugin, with elasticsearch listed as a maven  
> > dependency in the pom.xml file. I am trying to run my JUnit tests from  
> > that spot, and it seems that even with a es-plugin.properties pointing to  
> > my plugin, its not being picked up. In this case, the elasticsearch code  
> > is available for me to build, but I assume the plugin is not being picked  
> > up because elasticsearch is never being run??
> > 
> > Should I instead have a project setup where I am in the source for  
> > Elasticsearch, and I have imported my plugin folder to that projects  
> > classpath?
> > 
> > Hope that makes sense
> > 
> > -Matt
> > 
> > On Wednesday, October 23, 2013 3:00:31 PM UTC-4, Igor Motov wrote:
> > 
> > > Hi Matt,
> > > 
> > > In case of unit tests, for the plugin to be loaded, it's enough for it  
> > > to be in Elasticsearch classpath. In general plugin loading is done in two  
> > > main steps.  
> > > First, jar files in the plugins directory are added to class path. This  
> > > is irrelevant step in your case since your plugin is already in class path.  
> > > Once all jars are added to the class path, Elasticsearch searches class  
> > > path for files called es-plugin.properties and creates new instances of  
> > > the Plugin class that "plugin" property of es-plugin.properties file is  
> > > pointing to. So, make sure that you have es-plugin.properties file in path  
> > > an that it points to the right class and that an object of this class is  
> > > getting instantiated. When plugin object is instantiated Elasticsearch  
> > > starts interacting with different plugin methods such as giving it access  
> > > to modules, via onModule and processModule methods, loading module from  
> > > plugin itself, starting plugin's services, etc.
> > > 
> > > Igor
> > > 
> > > On Tuesday, October 22, 2013 8:55:56 PM UTC-4, Matt Sullivan wrote:
> > > 
> > > > I am having trouble trying to debug my elasticsearch plugin via  
> > > > eclipse.
> > > > 
> > > > I can build my plugin fine, and install it to a version of elastic  
> > > > search i built on my machine.
> > > > 
> > > > But its not working properly...
> > > > 
> > > > In order to debug my plugin, I am trying to run unit tests (via eclipse  
> > > > jUnit), but it is obvious from the errors being thrown in my test that my  
> > > > plugin is not installed in the version of elasticsearch my tests are  
> > > > running against
> > > > 
> > > > In my workspace i have imported my plugin's folder/ and a checkout of  
> > > > the latest version of Elasticsearch
> > > > 
> > > > What is the proper setup to get my plugin to be installed into  
> > > > elasticsearch, and still be able to debug it (I am not touching the  
> > > > Elasticsearch source code, i have it important as a point of reference and  
> > > > figured it would be good practice to build it on my own).
> > > > 
> > > > -matto
> > > > 
> > > > On Friday, April 12, 2013 1:23:56 PM UTC-4, Igor Motov wrote:
> > > > 
> > > > > Unit test is definitely the way to go. But if you want to start  
> > > > > elasticsearch with your plugin loaded, just start  
> > > > > org.elasticsearch.bootstrap.Bootstrap as the main class and add  
> > > > > -Des.foreground=true as VM parameter.
> > > > > 
> > > > > On Thursday, April 11, 2013 10:54:33 AM UTC-4, David Pilato wrote:
> > > > > 
> > > > > > I would say:
> > > > > > 
> > > > > > Create a JUnit test or a main().  
> > > > > > Launch it in debug mode.
> > > > > > 
> > > > > > As you plugin is in the class path, it will be loaded by  
> > > > > > Elasticsearch.
> > > > > > 
> > > > > > Here is an example of tests I write for my own plugins:  
> > > > > > [https://github.com/dadoonet/fsriver/blob/master/src/test/java/org/elasticsearch/river/fs/FsRiverFileSizeDisabledTest.java](https://github.com/dadoonet/fsriver/blob/master/src/test/java/org/elasticsearch/river/fs/FsRiverFileSizeDisabledTest.java)
> > > > > > 
> > > > > > ## HTH
> > > > > > 
> > > > > > _David Pilato_ | _Technical Advocate_ | _[Elasticsearch.com](http://Elasticsearch.com)_  
> > > > > > @dadoonet [https://twitter.com/dadoonet](https://twitter.com/dadoonet) | @elasticsearchfr[https://twitter.com/elasticsearchfr](https://twitter.com/elasticsearchfr)  
> > > > > > | @scrutmydocs [https://twitter.com/scrutmydocs](https://twitter.com/scrutmydocs)
> > > > > > 
> > > > > > Le 11 avr. 2013 à 16:51, kiruba karan [rkir...@gmail.com](mailto:rkir...@gmail.com) a écrit :
> > > > > > 
> > > > > > Hi all,
> > > > > > 
> > > > > > ```
> > > > > > i need to debug elasticsearch plugin from eclipse IDE. how 
> > > > > > 
> > > > > > ```
> > > > > > 
> > > > > > can i do this? i searched lot but didn't get any solution. can any one tell  
> > > > > > me how to configure debugging for elasticsearch plugin.
> > > > > > 
> > > > > > _note:_ i learned how to create elasticsearch plugin from this site  
> > > > > > [http://jfarrell.github.io/](http://jfarrell.github.io/)
> > > > > > 
> > > > > > --  
> > > > > > You received this message because you are subscribed to the Google  
> > > > > > Groups "elasticsearch" group.  
> > > > > > To unsubscribe from this group and stop receiving emails from it,  
> > > > > > send an email to [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com).  
> > > > > > For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Matt\_Sullivan](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/matt_sullivan/32/2016_2.png) [@Matt\_Sullivan](https://discuss.elastic.co/u/Matt_Sullivan)\
**Post date:** [October 29, 2013, 5:15pm UTC](https://discuss.elastic.co/t/how-to-debug-elasticsearch-plugin-using-eclipse/11551/9 "2013-10-29T17:15:22Z")

</div>

Igor,  
Thanks for taking the time to give detailed steps. I am now able to  
debug my plugin via eclipse.

```
I was def not pointing at org.elasticsearch.bootstrap.Bootstrap before, 

```

and I think that was a large part of the problem.

```
I also have the m2e <http://www.eclipse.org/m2e/> plugin installed, 

```

which apparently causes issues when trying to use mvn via command line and  
the plugin (you have to use one or the other).  
Starting from scratch and following your import steps I was able to get  
it going.

Thank you much,  
Matt

On Saturday, October 26, 2013 9:13:13 PM UTC-4, Igor Motov wrote:

> Hi Matt,
> 
> I typically use IntelliJ for Java development, but I just downloaded the  
> latest version of Eclipse and tried to perform the following steps with one  
> of my plugin projects:
> 
> - Started eclipse to create workspace
> 
> - In command line, I had to run it since I had new workspace:  
> $ mvn -Declipse.workspace=  
> eclipse:add-maven-repo
> 
> - Restarted eclipse
> 
> - Back in command line in temp directory, cloned my project  
> $ git clone [git@github.com](mailto:git@github.com):imotov/elasticsearch-native-script-example.git  
> $ cd elasticsearch-native-script-example  
> $ mvn eclipse:eclipse
> 
> - Back in eclipse:
> 
> - Selected File-\>Import...-\>General-\>Existing Project into Workspace-\>Next
> 
> - In the Select root directory window selected  
> path-to-elasticsearch-native-script-example, Pressed Finish
> 
> - Selected Run-\>Run Configurations...-\>Select Java Application-\>Pressed  
> New Button
> 
> - In the Project window selected elasticsearch-native-script-example
> 
> - In the Main class window selected org.elasticsearch.bootstrap.Bootstrap
> 
> - Clicked on Arguments tab
> 
> - In the VM arguments window typed -Des.foreground=true
> 
> - Clicked Run
> 
> - Back in command line, verified that plugin is indeed loaded and  
> functional:  
> $ cd example  
> $ sh lookup.sh
> 
> So, I think if a plugin project is setup correctly everything works fine  
> in eclipse. I hope this example will help.
> 
> Igor
> 
> On Saturday, October 26, 2013 11:42:21 AM UTC-4, Matt Sullivan wrote:
> 
> > Just tried coming at it from elasticsearch to no avail. Trying my  
> > best to understand how to keep my plugin code separate from elasticsearch  
> > code.
> > 
> > If i import the elasticsearch maven project into eclipse, and then import  
> > my plugin, they get imported as siblings in the workspace.
> > 
> > If i try to add my plugins folder to the source path from the properties  
> > build path, it only allows my to chose folders that are subfolders of the  
> > Elasticsearch code.
> > 
> > -matt
> > 
> > On Saturday, October 26, 2013 10:55:10 AM UTC-4, Matt Sullivan wrote:
> > 
> > > Igor,  
> > > Thanks for the help. I guess where I am confused is... I working (in  
> > > Eclipse) in the folder of my plugin, with elasticsearch listed as a maven  
> > > dependency in the pom.xml file. I am trying to run my JUnit tests from  
> > > that spot, and it seems that even with a es-plugin.properties pointing to  
> > > my plugin, its not being picked up. In this case, the elasticsearch code  
> > > is available for me to build, but I assume the plugin is not being picked  
> > > up because elasticsearch is never being run??
> > > 
> > > Should I instead have a project setup where I am in the source for  
> > > Elasticsearch, and I have imported my plugin folder to that projects  
> > > classpath?
> > > 
> > > Hope that makes sense
> > > 
> > > -Matt
> > > 
> > > On Wednesday, October 23, 2013 3:00:31 PM UTC-4, Igor Motov wrote:
> > > 
> > > > Hi Matt,
> > > > 
> > > > In case of unit tests, for the plugin to be loaded, it's enough for it  
> > > > to be in Elasticsearch classpath. In general plugin loading is done in two  
> > > > main steps.  
> > > > First, jar files in the plugins directory are added to class path. This  
> > > > is irrelevant step in your case since your plugin is already in class path.  
> > > > Once all jars are added to the class path, Elasticsearch searches class  
> > > > path for files called es-plugin.properties and creates new instances of  
> > > > the Plugin class that "plugin" property of es-plugin.properties file is  
> > > > pointing to. So, make sure that you have es-plugin.properties file in path  
> > > > an that it points to the right class and that an object of this class is  
> > > > getting instantiated. When plugin object is instantiated Elasticsearch  
> > > > starts interacting with different plugin methods such as giving it access  
> > > > to modules, via onModule and processModule methods, loading module from  
> > > > plugin itself, starting plugin's services, etc.
> > > > 
> > > > Igor
> > > > 
> > > > On Tuesday, October 22, 2013 8:55:56 PM UTC-4, Matt Sullivan wrote:
> > > > 
> > > > > I am having trouble trying to debug my elasticsearch plugin via  
> > > > > eclipse.
> > > > > 
> > > > > I can build my plugin fine, and install it to a version of elastic  
> > > > > search i built on my machine.
> > > > > 
> > > > > But its not working properly...
> > > > > 
> > > > > In order to debug my plugin, I am trying to run unit tests (via  
> > > > > eclipse jUnit), but it is obvious from the errors being thrown in my test  
> > > > > that my plugin is not installed in the version of elasticsearch my tests  
> > > > > are running against
> > > > > 
> > > > > In my workspace i have imported my plugin's folder/ and a checkout of  
> > > > > the latest version of Elasticsearch
> > > > > 
> > > > > What is the proper setup to get my plugin to be installed into  
> > > > > elasticsearch, and still be able to debug it (I am not touching the  
> > > > > Elasticsearch source code, i have it important as a point of reference and  
> > > > > figured it would be good practice to build it on my own).
> > > > > 
> > > > > -matto
> > > > > 
> > > > > On Friday, April 12, 2013 1:23:56 PM UTC-4, Igor Motov wrote:
> > > > > 
> > > > > > Unit test is definitely the way to go. But if you want to start  
> > > > > > elasticsearch with your plugin loaded, just start  
> > > > > > org.elasticsearch.bootstrap.Bootstrap as the main class and add  
> > > > > > -Des.foreground=true as VM parameter.
> > > > > > 
> > > > > > On Thursday, April 11, 2013 10:54:33 AM UTC-4, David Pilato wrote:
> > > > > > 
> > > > > > > I would say:
> > > > > > > 
> > > > > > > Create a JUnit test or a main().  
> > > > > > > Launch it in debug mode.
> > > > > > > 
> > > > > > > As you plugin is in the class path, it will be loaded by  
> > > > > > > Elasticsearch.
> > > > > > > 
> > > > > > > Here is an example of tests I write for my own plugins:  
> > > > > > > [https://github.com/dadoonet/fsriver/blob/master/src/test/java/org/elasticsearch/river/fs/FsRiverFileSizeDisabledTest.java](https://github.com/dadoonet/fsriver/blob/master/src/test/java/org/elasticsearch/river/fs/FsRiverFileSizeDisabledTest.java)
> > > > > > > 
> > > > > > > ## HTH
> > > > > > > 
> > > > > > > _David Pilato_ | _Technical Advocate_ | _[Elasticsearch.com](http://Elasticsearch.com)_  
> > > > > > > @dadoonet [https://twitter.com/dadoonet](https://twitter.com/dadoonet) | @elasticsearchfr[https://twitter.com/elasticsearchfr](https://twitter.com/elasticsearchfr)  
> > > > > > > | @scrutmydocs [https://twitter.com/scrutmydocs](https://twitter.com/scrutmydocs)
> > > > > > > 
> > > > > > > Le 11 avr. 2013 à 16:51, kiruba karan [rkir...@gmail.com](mailto:rkir...@gmail.com) a écrit :
> > > > > > > 
> > > > > > > Hi all,
> > > > > > > 
> > > > > > > ```
> > > > > > > i need to debug elasticsearch plugin from eclipse IDE. how 
> > > > > > > 
> > > > > > > ```
> > > > > > > 
> > > > > > > can i do this? i searched lot but didn't get any solution. can any one tell  
> > > > > > > me how to configure debugging for elasticsearch plugin.
> > > > > > > 
> > > > > > > _note:_ i learned how to create elasticsearch plugin from this site  
> > > > > > > [http://jfarrell.github.io/](http://jfarrell.github.io/)
> > > > > > > 
> > > > > > > --  
> > > > > > > You received this message because you are subscribed to the Google  
> > > > > > > Groups "elasticsearch" group.  
> > > > > > > To unsubscribe from this group and stop receiving emails from it,  
> > > > > > > send an email to [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com).  
> > > > > > > For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 6, 2017, 2:09am UTC](https://discuss.elastic.co/t/how-to-debug-elasticsearch-plugin-using-eclipse/11551/10 "2017-07-06T02:09:59Z")

</div>


