How to debug elasticsearch plugin using eclipse


(kiruba) #1

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/

--
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.
For more options, visit https://groups.google.com/groups/opt_out.


(David Pilato) #2

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

HTH

David Pilato | Technical Advocate | Elasticsearch.com
@dadoonet | @elasticsearchfr | @scrutmydocs

Le 11 avr. 2013 à 16:51, kiruba karan 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/

--
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.
For more options, visit 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.
For more options, visit https://groups.google.com/groups/opt_out.


(Igor Motov) #3

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

HTH

David Pilato | Technical Advocate | Elasticsearch.com
@dadoonet https://twitter.com/dadoonet | @elasticsearchfrhttps://twitter.com/elasticsearchfr
| @scrutmydocs https://twitter.com/scrutmydocs

Le 11 avr. 2013 à 16:51, kiruba karan <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/

--
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 <javascript:>.
For more options, visit 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.
For more options, visit https://groups.google.com/groups/opt_out.


(Matt Sullivan) #4

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 elastic search

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
elastic search 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

HTH

David Pilato | Technical Advocate | Elasticsearch.com
@dadoonet https://twitter.com/dadoonet | @elasticsearchfrhttps://twitter.com/elasticsearchfr
| @scrutmydocs https://twitter.com/scrutmydocs

Le 11 avr. 2013 à 16:51, kiruba karan 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/

--
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.
For more options, visit 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.
For more options, visit https://groups.google.com/groups/opt_out.


(Igor Motov) #5

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 elastic search

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
elastic search 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

HTH

David Pilato | Technical Advocate | Elasticsearch.com
@dadoonet https://twitter.com/dadoonet | @elasticsearchfrhttps://twitter.com/elasticsearchfr
| @scrutmydocs https://twitter.com/scrutmydocs

Le 11 avr. 2013 à 16:51, kiruba karan 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/

--
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.
For more options, visit 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.
For more options, visit https://groups.google.com/groups/opt_out.


(Matt Sullivan) #6

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 elastic search

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
elastic search 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

HTH

David Pilato | Technical Advocate | Elasticsearch.com
@dadoonet https://twitter.com/dadoonet | @elasticsearchfrhttps://twitter.com/elasticsearchfr
| @scrutmydocs https://twitter.com/scrutmydocs

Le 11 avr. 2013 à 16:51, kiruba karan 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/

--
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.
For more options, visit 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.
For more options, visit https://groups.google.com/groups/opt_out.


(Matt Sullivan) #7

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
elastic search 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 elastic search

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
elastic search 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

HTH

David Pilato | Technical Advocate | Elasticsearch.com
@dadoonet https://twitter.com/dadoonet | @elasticsearchfrhttps://twitter.com/elasticsearchfr
| @scrutmydocs https://twitter.com/scrutmydocs

Le 11 avr. 2013 à 16:51, kiruba karan 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/

--
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.
For more options, visit 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.
For more options, visit https://groups.google.com/groups/opt_out.


(Igor Motov) #8

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: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
elastic search 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 elastic search

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
elastic search 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

HTH

David Pilato | Technical Advocate | Elasticsearch.com
@dadoonet https://twitter.com/dadoonet | @elasticsearchfrhttps://twitter.com/elasticsearchfr
| @scrutmydocs https://twitter.com/scrutmydocs

Le 11 avr. 2013 à 16:51, kiruba karan 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/

--
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.
For more options, visit 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.
For more options, visit https://groups.google.com/groups/opt_out.


(Matt Sullivan) #9

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: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
elastic search 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 elastic search

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
elastic search 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

HTH

David Pilato | Technical Advocate | Elasticsearch.com
@dadoonet https://twitter.com/dadoonet | @elasticsearchfrhttps://twitter.com/elasticsearchfr
| @scrutmydocs https://twitter.com/scrutmydocs

Le 11 avr. 2013 à 16:51, kiruba karan 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/

--
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.
For more options, visit 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.
For more options, visit https://groups.google.com/groups/opt_out.


(system) #10