1

New to Eclipse and Solr, I imported apache-solr-3.6.0.war into Eclipse and run Solr with tomcat plugin. Now i want to debug some existing code, however how do i import the Solr source code?

trillions
  • 3,669
  • 10
  • 40
  • 59

4 Answers4

3

Without knowing how you imported it exactly: sounds like you are looking for Source attachment.

It might be better if you use the Solr source code directly. Check the README file included in the release, there is an ant task to init eclipse:

To setup your ide run [...] 'ant eclipse'.

Then all dependencies are loaded using ivy and you can run it from within the IDE.

Community
  • 1
  • 1
Wolfram
  • 8,044
  • 3
  • 45
  • 66
  • The work requirement was to use solr's existing libraries, not to build it on our own. Now i realized that there are so many libraries in Referenced Libraries, so i guess i have to find source for the jar i am using and attach to the jar? @@ – trillions Jul 11 '12 at 21:49
  • Wolfram, thanks a lot for helping me! :) Once i get time, I will also try directly build the solr source myself following your tips. – trillions Jul 11 '12 at 21:57
2

You can also check out the whole Lucene/Solr source:

  1. install Subclipse add-in
  2. choose New... > Project...
  3. SVN > Checkout projects from SVN...
  4. add this link as new repository
  5. select branch /branches/lucene_solr_3_6 (if you want last stable version. Use trunk if you want to use cutting edge source)
  6. choose Check out as a project in a workspace and leave everything else default

Then, after the checkout completes, to complete setup, you don't have to fiddle with JARs manually, simply:

  1. right click on main build.xml, the one in your project's root
  2. choose Run As... > Ant build... select (in this order)
  3. ivy-bootstrap and resolve tasks (which will download all JAR dependencies)
  4. then run in this order: validate, clean-idea, eclipse, compile, get-maven-poms, generate-maven-artifacts (the last two only if you plan to use Maven).

And that's it, you should now see no redness in your workspace and have Lucene and Solr JARs built.

Marko Bonaci
  • 5,622
  • 2
  • 34
  • 55
2

Run solr like this:

java -jar -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=1044 start.jar

Solr will start, but wait you to connect from Eclipse to continue.

Then in Eclipse, go to:

  1. Run / Debug Configurations...
  2. Select Remote Java Application
  3. Press New button to create a new remote configuration
  4. put 1044 on port
  5. Click on Debug

This is the standard way to debug remote applications in Java

Daniel Cukier
  • 11,502
  • 15
  • 68
  • 123
1
./solr start -p 8983 -f -a "-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=0.0.0.0:8000"

Start solr with

  1. provide app run on port 8983
  2. provide Xrunjdwp:transport=dt_socket
  3. remote ip address 0.0.0.0:8000 and then go to eclipse solr debug mode config in eclipse
Akoffice
  • 341
  • 2
  • 6