-
1. Re: Adding JBoss AS source to a project
dgolovin Jan 5, 2010 3:48 PM (in response to henk53)You can just unpack archive with sources somewhere and configure Java Source Attachment properties for particular jar. Just point to root folder of unpacked archive and eclipse will take care about everything else.
Be aware that not all archives that appear in JBoss AS class path containers are built form those sources, there are many third party archives that have no matching source in source archive.
For example you are using JBoss AS 4.2.2.GA so you have sources unpacked somewhere
~/temp/jboss-4.2.2.GA-src
If you expand JBoss As 4.2.2.GA classpath container and configure in Properties dialog Java Source Attachment properties for policy.jar like
Location Path: /home/username/temp/jboss-4.2.2.GA-src
that doesn't affect eclipse behavior and it is still not able to find sources for this jar. It happens because it is 3rd party dependency which comes ( I guess) from apache foundation.
But if you do the same for jboss-ejb3-client.jar, It works.
You also can zip or jar ~/temp/jboss-4.2.2.GA-src and set Location Path to that zip or jar. It works the same way as external folder but saves a lot of disk space.
-
2. Re: Adding JBoss AS source to a project
dgolovin Jan 5, 2010 4:09 PM (in response to henk53)Some screen shots below show an example for one jar from JBoss AS 4.2.2.GA classpath container.
I've unpacked sources archive for JBoss AS 4.2.2.GA to /home/eskimo/Temp/jboss-4.2.2.GA-src and configured properties for jboss-ejb3x.jar
After that eclipse shows source for classes from jar like it shown below for javax.annotation.Generated annotation
The only drawback is you have to do it for each jar you need to see the sources.
-
3. Re: Adding JBoss AS source to a project
henk53 Jan 6, 2010 2:34 PM (in response to dgolovin)dgolovin wrote:
The only drawback is you have to do it for each jar you need to see the sources.
And that, quite frankly, are a LOT of jars
I thank you for your answer and the screenshots, but I was actually looking for an easy single jar file attachment.
-
4. Re: Adding JBoss AS source to a project
dgolovin Jan 6, 2010 8:08 PM (in response to henk53)It sounds like a feature request then Wanna add it to JBoss Tools JIRA for JBossAS component? Feel free to add it here https://jira.jboss.org/jira/browse/JBIDE. Do not forget to check that there is no similar issue here. -
5. Re: Adding JBoss AS source to a project
maxandersen Jan 7, 2010 5:00 AM (in response to dgolovin)We dont produce the source jars, that is an issue for JBoss AS.
I would think they soon should be able to have proper maven source jars for these, but doesnt hate to remind them about your usecase
-
6. Re: Adding JBoss AS source to a project
dgolovin Jan 7, 2010 12:55 PM (in response to maxandersen)JBossAS jars have pom.xml inside but I cannot find a way to get sources for it usin m2eclipse. I was sinking about having "Source location" field in Server Runtime definition and just use it by default as Source Attachment attribute for every jar in JBoss AS ClassPath container.
We can support only external folder for that in first version and that means JBoss AS src distribution should be unpacked first.
That's a good feature because it is Open Source project and it should help developers to have easy access to other sources
-
-
8. Re: Adding JBoss AS source to a project
dgolovin Jan 14, 2010 1:16 PM (in response to henk53)First approach I suggested above is for browsing sources in jars inside JBoss AS Classpath Container. I found better way to configure sources lookup for server during debug session:
1. Create JBoss AS Runtime and Server
2. Deploy your application on that server
3. Create breakpoint somewhere inside your code that is going to be called by JBoss AS
4. Start server from step 3 in Debug mode
5. Open Debug View and invoke "Edit Source Lookup Path" dialog for server through "Edit Source Lookup..." Item in popup menu
In opened Dialog (see image below) press "Add" button
Then select File System Directory type and press Ok.
Point to root folder for JBoss AS sources and Do not forget to select "Search subfolders"
Finish all opened fialog by pressing "Ok"
6. Try to open your application in browse.
7. When you make got to breakpoint eclipse will be able to search JBoss AS sources in path you configured on step 5.
-
9. Re: Adding JBoss AS source to a project
atijms Jan 29, 2010 6:50 AM (in response to dgolovin)I tried exactly what you said, but it doesn't seem to work. It seems like this only works for directories containing .java files, not for directories containing .jar files.
When I click on "Edit Source Lookup..." again, then my source directory "jboss-5.1.0.GA-src" has indeed been added, and when I unfold it I can see all directories of the source archive, but unlike the "Default" source lookup path, not a single jar file is listed.
I think a big problem regarding JBoss AS sources is that the structure of the source archive is *completely* different from that of the compiled product. For instance, suppose you were looking for the sources of jboss-web-service.jar. This file is located in the binary distribution at /server/default/deploy/jbossweb.sar/jboss-web-service.jar. There is no way the source code location even remotely resembles this. Even if the path would not exactly match (since it's actually /server/*/deploy/jbossweb.sar/jboss-web-service.jar), then still one would expect some file called jboss-web-service-src.jar.
Again, this is not how the source is organized. Maybe the source of jboss-web-service-src.jar is within an archive located in thirdpary/jboss/foo/bar/kaz-all.jar. You just don't know... and -that- is the problem.
Maybe a solution is to recursively unjar every .jar file to a central location and then jar it up again. I don't know... but I do know that the current situation leaves a lot to be desired.
-
10. Re: Adding JBoss AS source to a project
atijms Jan 29, 2010 7:46 AM (in response to dgolovin)p.s.
I found the source of the mentioned example class in /tomcat/src/main/org/jboss/web/tomcat/security/login/WebAuthentication.java.
Using the method of setting the source via "Edit Source lookup" in the debug view, the source of this particular class can be found when stepping into a method from this class using the debugger. So, this is definitely an improvement compared with not having sources at all.
However, ctrl-click into this class from the Java editor still doesn't work, and you often need this too when programming.
And, as mentioned before, stepping into a class where Jboss AS ships the source in a jar doesn't work at all (neither stepping into it nor via crtl-clicking on it).
-
11. Re: Adding JBoss AS source to a project
dgolovin Jan 29, 2010 3:09 PM (in response to atijms)atijms wrote:
I tried exactly what you said, but it doesn't seem to work. It seems like this only works for directories containing .java files, not for directories containing .jar files.
When I click on "Edit Source Lookup..." again, then my source directory "jboss-5.1.0.GA-src" has indeed been added, and when I unfold it I can see all directories of the source archive, but unlike the "Default" source lookup path, not a single jar file is listed.
Right, it is solution for JBoss AS only, because they have source distribution archive which contains only *.java files inside. Eclipse has no source lookup type, that visiting jar files. But you can use Archive or External Archive type to configure them. It supports multi selection so it should be easier than configuring them one by one
BTW this External Archive type can be used to configure JBoss AS sources without unpacking sources archive.
atijms wrote:
I think a big problem regarding JBoss AS sources is that the structure of the source archive is *completely* different from that of the compiled product. For instance, suppose you were looking for the sources of jboss-web-service.jar. This file is located in the binary distribution at /server/default/deploy/jbossweb.sar/jboss-web-service.jar. There is no way the source code location even remotely resembles this. Even if the path would not exactly match (since it's actually /server/*/deploy/jbossweb.sar/jboss-web-service.jar), then still one would expect some file called jboss-web-service-src.jar.
Again, this is not how the source is organized. Maybe the source of jboss-web-service-src.jar is within an archive located in thirdpary/jboss/foo/bar/kaz-all.jar. You just don't know... and -that- is the problem.
The problem is that JBoss AS sources doesn't include 3rd party sources, I guess. It includes only sources that are really compiled during build. If something was bundled in as binary dependency, it has no sources inside JBoss AS source distribution. To configure source look up for 3rd party jars you need to process one jar at time and that can be done when required by using "Attach Source..." button.
We have source browser implementation that understands *src.zip archives, but that in lab component and it is not included in build.
-
12. Re: Adding JBoss AS source to a project
dgolovin Jan 29, 2010 3:33 PM (in response to atijms)It works only for Debug view, because sources to lookup attached to particular process.
But you're right that there are several places where you can access sources in eclipse:
1. Classpath jar browsing
2. Ctrl+Click navigation in source
3. Debug View Stacktrace browsing
1 and 2 are based on sources attached to jar files in project Classpath
3 is actually using "chain of responsibility", it tries to get sources attached to jars and then source lookup (need to check if that right suggestion )
So solution here would be to have field or complex widget (like Source Lookup) in new server runtime wizard and server runtime editor to configure server sources location(s)/lookup. As soon as we have that 1,2 and 3 can be configured automatically for project and server launcher.
For instance, you created JBoss AS 4.2.2 runtime and provided an archive with sources. This archive can be used to initialize Java Source Attachment preferences for every jar in server classpath container and that means points 1,2 should work. Source Lookup also can be configured using provided archive and that makes point 3 working as well. -
13. Re: Adding JBoss AS source to a project
john.waterwood Jan 29, 2010 6:42 PM (in response to dgolovin)This external archive is possible, but takes us back to square one. As others pointed out, it's quite hard to match the right jar in Eclipse to the right source jar in the Jboss source archive. Also, the jboss source archive does contain the source code for third party libs, but these are all packaged in jar files. For the end user it's not always logical when something is or isn't a third party lib. Eg Jboss as implements Java ee and JSF is part of java ee. Thus the end user probably expects the jsf sources to be part of "jboss as". There are also many jar files containing jboss source code as jars in the thirdparty folder. For the end user it is very hard to understand why this is I think. -
14. Re: Adding JBoss AS source to a project
dgolovin Jan 29, 2010 7:02 PM (in response to john.waterwood)john.waterwood wrote:
This external archive is possible, but takes us back to square one. As others pointed out, it's quite hard to match the right jar in Eclipse to the right source jar in the Jboss source archive.I would try to give eclipse a chanse to handle that for us considering we have an implememntation that uderstands sources packaged as zips, but I cannot find any thirdparty sources in source archive for jboss-4.2.2.GA.
john.waterwood wrote:
There are also many jar files containing jboss source code as jars in the thirdparty folder. For the end user it is very hard to understand why this is I think.I'm looking at boss-4.2.2.GA sources (just one I have locally), I've checked several jars from thirdpaty folder and haven't seen any sources. Is that true for all releases or only for last ones?