it may seem like overkill, but if you use maven and include source, the mvn eclipse plugin will generate all the source configuration needed to give you all the in-line documentation you could ask for.
another thought for making that easier when using an automated build:
when you create a jar of one of your projects, also create a source files jar:
instead of going into the build path options dialog to add a source reference to each jar, try the following: add one source reference through the dialog. edit your .classpath and using the first jar entry as a template, add the source jar files to each of your other jars.
this way you can use eclipse's navigation aids to their fullest while still using something more standalone to build your projects.
i was going to ask for an alternative to attaching sources to the same jar being used across multiple projects. originally, i had thought that the only alternative is to re-build the jar with the source included but looking at the "user library" feature, you don't have to build the jar with the source.
this is an alternative when you have multiple projects (related or not) that reference the same jar. create an "user library" for each jar and attach the source to them. next time you need a specific jar, instead of using "add jars..." or "add external jars..." you add the "user library" that you have previously created.
you would only have to attach the source once per jar and can re-use it for any number of projects.
just click on attach source and select folder path ... name will be same as folder name (in my case). remember one thing you need to select path upto project folder base location with "\" at suffix ex d:\myproject\
another option is to right click on your jar file which would be under (your project)->referenced libraries->(your jar) and click on properties. then click on java source attachment. and then in location path put in the location for your source jar file.
this is just another approach to attaching your source file.
another way is to add the folder to your source lookup path: http://help.eclipse.org/helios/index.jsp?topic=%2forg.eclipse.jdt.doc.user%2freference%2fviews%2fdebug%2fref-editsourcelookup.htm
if you build your libraries with gradle, you can attach sources to the jars you create and then eclipse will automatically use them. see the answer by @michaeloryl how to build sources jar with gradle.
copied here for your reference:
the solution shown is for use with the gradle java plugin. mileage may vary if you're not using that plugin.
- put source files into a zip file (as it does for java source)
- go to project properties -> libraries
- select source attachment and click 'edit'
- on source attachment configuration click 'variable'
- on "variable selection" click 'new'
- put a meaningful name and select the zip file created in step 1
- click on the java code you want to see. (click on list to open list.java if you want to check source code for java.util.list)
- click on "attach source" button.
- you will be asked to "select the location (folder, jar or zip) containing the source for rt.jar).
- select "external location" option. locate the src.zip file.
- path for src.zip is : *\java\jdk1.8.0_45\src.zip
when you add a jar file to a classpath you can attach a source directory or zip or jar file to that jar. in the java build path properties, on the libraries tab, expand the entry for the jar and you'll see there's an item for the source attachment. select this item and then click the edit button. this lets you select the folder, jar or zip that contains the source.
additionally, if you select a class or a method in the jar and ctrl+click on it (or press f3) then you'll go into the bytecode view which has an option to attach the source code.
doing these things will give you all the parameter names as well as full javadoc.
if you don't have the source but do have the javadoc, you can attach the javadoc via the first method. it can even reference an external url if you don't have it downloaded.
i've found that sometimes, you point to the directory you'd assume was correct, and then it still states that it can't find the file in the attached source blah blah.
these times, i've realized that the last path element was "src". just removing this path element (thus indeed pointing one level above the actual path where the "org" or "com" folder is located) magically makes it work.
somehow, eclipse seems to imply this "src" path element if present, and if you then have it included in the source path, eclipse chokes. or something like that.
yes there is a easy way... go to ... http://sourceforge.net/projects/jdk7src/ and download the zip file. then attach this to the eclipse. give the path where you have downloaded the zip file in eclipse. we can then browse through the source.
an easy way of doing this is :
download the respective src files/folder.
in the eclipse editor, ctrl+click or f3 on a method/class you need the source for. a new tab opens up which says "no attached source found".
click the "attach sources" button, click the "attach source folder" button, browse to the location of the downloaded src folder. done!
(p.s : button labels may vary slightly, but this is pretty much it.)
up until yesterday i was stuck painstakingly downloading source zips for tons of jars and attaching them manually for every project. then a colleague turned me on to the java source attacher. it does what eclipse should do - a right click context menu that says "attach java source".
it automatically downloads the source for you and attaches it. i've only hit a couple libraries it doesn't know about and when that happens it lets you contribute the url back to the community so no one else will have a problem with that library.
short answer would be yes.
you can attach source using the properties for a project.
go to properties (for the project) -> java build path -> libraries
select the library you want to attach source/javadoc for and then expand it, you'll see a list like so:
source attachment: (none)
javadoc location: (none)
native library location: (none)
access rules: (no restrictions)
select javadoc location and then click edit on the right hahnd side. it should be quite straight forward from there.
good luck :)
- Is there an easy way to attach source in Eclipse?
- is there an easy way to import a black-on-white color scheme in Eclipse
- Developing for android, is there a way to cause eclipse to rebuild an app when only the source of its libraries was modified?
- In the Eclipse HTML editor, is there an easy way to have custom tags available in content assist (autocomplete)?
- Is there a way to organize the source tree in Eclipse Java project?
- Is there a way to revert eclipse android ADT from r17 to r16 since javadoc and source attachment is broken?
- Is there an easy way to generate documentation for eclipse without disturbing the code?
- Is there a good way to add Equinox source to Eclipse to help debugging an OSGi bundle?
- Is there a way to quickly capitalize the variable name in Eclipse
- How to attach source or JavaDoc in eclipse for any jar file e.g. JavaFX?
- Is there a way to fold eclipse sub-blocks like an "if" statement?
- Is there way to expand all folders in Eclipse project view and search results?
- Is there a way to hide Maven 2 "target/" folder in Eclipse 3?
- Is there a way to upgrade eclipse and keep all the installed plugins?
- Is there any way to integrate Eclipse with Gradle in Android project?
- How to attach Android Source to Eclipse
- Attach the Source in Eclipse of a jar
- Is there any way of configuring Eclipse IDE proxy settings via an autoproxy configuration script?
- Easy way to copy old plugins into new install of eclipse
- Is there a way to prevent Eclipse from opening the browser when starting a Web application?
- Is there a way to make Eclipse run a JUnit test multiple times until failure?
- Is there a way to force Eclipse to automatically restart remote debugging (in listen mode)?
- Is there a way to add the workspace path to the Eclipse IDE title bar?
- Is there a way to tell Eclipse to "Save all" before building?
- Is there a way in the Eclipse debugger to be notified when the state of a Java object changes?
- Is there a way to have Eclipse automatically make all my variables final?
- In Eclipse, when debugging, is there an easy way to see a variable's total memory size?
- Is there a way to delete meta-data on Eclipse run configurations?
- Is there a way to directly generate Step Definitions in Eclipse without Running Cucumber?
- Is there a way to capitalize the first letter of a value of a variable in Eclipse (Helios) code templates
More Query from same tag
- Jira Mylyn respository not showing on SpringToolSuite 3.7.1
- How can I create a multi module project in Eclipse/Maven - Just ONE big project
- Reading Strings.xml file from apk file
- Eclipse Oracle Hibernate StringIndexOutOfBoundsException
- Codename One project jar file is not generated
- How to add folder of property files in eclipse
- Highlighting a point (or an offset) in a file instead of a region
- How do I enter escape characters in eclipse expressions (Java)?
- How can I use an eclipse environment variable as GDB path?
- Open another editor from the eclipse search view
- Eclipse can't find Jersey imports
- mvn command not found in eclipse but works on terminal
- No error, but code won't run, Exception in Application start method JavaFX
- How to enable Eclipse debugging features in a web application?
- JavaFX in Eclipse Kepler: New FXML Document option is missing
- Annotations help in java
- Button cannot be resolved to a type
- Sending and receiving text using android emulator
- Eclipse closing unexpectedly when auto suggestion comes
- Maven showing error when trying to connect to cloudera url for cdh jar location
- Eclipse Mars 2 SmartHome (OOMPH) - Cannot build SmartHome projects
- Code completion for custom modules not working with PyDev
- Insert new element in JsonArray
- problem with importing a package in eclipse
- How to find the parent of a Maven transitive dependency
- Eclipse/GGTS crash with Java 7 on Mac OS X?
- Eclipse CDT using MinGW does not output in console
- Setting a project as the main project in eclipse
- what's the question mark on this file means "twitter4j"
- convert dynamic web project to maven project