1 2 3 4 5 Previous Next 69 Replies Latest reply on Jul 7, 2011 11:59 AM by atijms Go to original post
      • 15. Re: Adding JBoss AS source to a project
        john.waterwood

        I don't know about the sources of Jboss 4.2.2, but at least the jboss 5.1.0 source archive contains several jboss and thirdparty jar files with source. From the top of my head, these are at least the jsf (mojarra) sources and the jbosssx sources.

        With an implementation that understands sources packaged as zips, do you mean the ability of Eclipse to scan a folder recursively and automatically add all jar or zip files to the source lookup path? That would be rather neat really.

        • 16. Re: Adding JBoss AS source to a project
          john.waterwood

          about the several places to attach source (classpath, ctrl-click, debug), it is not really convenient for the user having to tell Eclipse twice where source code is related. Once for ctrl-click and browsing, and once for debug.

           

          I seem to remember that with MyEclipse I only had to attach source code once for each jar file (using package explorer, or in the project properties build path). The debugger would then automatically know about the source location too. In WTP with or without Jboss AS tools this does not seem to be the case.

          • 17. Re: Adding JBoss AS source to a project
            maxandersen

            If your project is setup to locate sources correctly then any debug launches that refer to that project should also work - if not then please report a bug.

             

            Beyond that the issue here is that JBoss AS should provide a src download that allows for easy matching of jar with source, one way would be if all the artifacts are in Maven repositories then we could attach the source automatically based on the Maven groupid and version.

            • 18. Re: Adding JBoss AS source to a project
              maxandersen

              Note, once we have a stable location for src's then jboss tools would most likely need to implement that for our classpath containers so you don't have to do it manually for each jar.

               

              Maybe we could even just implement a SourceLookupParticipant or similar in case of the src location not being explicitly known ?

              • 19. Re: Adding JBoss AS source to a project
                dgolovin

                max.andersen@jboss.com wrote:

                 

                If your project is setup to locate sources correctly then any debug launches that refer to that project should also work - if not then please report a bug.

                You're both right there is no reason to have source lookup configured if jars have attached sources.

                max.andersen@jboss.com wrote:

                 

                Beyond that the issue here is that JBoss AS should provide a src download that allows for easy matching of jar with source, one way would be if all the artifacts are in Maven repositories then we could attach the source automatically based on the Maven groupid and version.

                I couldn't find a way to get sources for jars built with maven using eclipse, I think that's a good feature to havein m2eclipse or in JBossTools.

                • 20. Re: Adding JBoss AS source to a project
                  dgolovin

                  That's what I proposed above. We cannot extend source matching mechanism for jar browsing ( at least I spend an hour to find extension point for that in JDT). Which means there is only way to configure "Source attachment" for jars from Server Classpath container, it is ether have a Server Runtime property which points you to zip/folder in local file system which contains sources or action/property/whatever which would help to configure it at once for all jars in server classpath container.

                   

                  Current eclipse can handle zips with sources and it will be able to found and match any source inside zip, but it doesn't know how to deal with archives inside archives. This can be solved by:

                  1. unpacking all jars/zips with .java files after asking permission from user.
                  2. by configuring source lookup using lookup type injected through extension point. This look up should understand archive sources in file system and archived sources in archive.

                   

                  I remember Rob mentioned plug-in in our lab component which has similar functionality and provides source lookup for *.src.zip files in selected for lookup folder. It can be adjusted to look inside *.jar files and after that we can handle looking into source archives inside selected source archive or file system. How, just by adding two types of source lookups: Eclipse's one for sources in external folder and our new one for archives in file system or archives inside archive.


                  Considering all above it looks doable for me

                  • 21. Re: Adding JBoss AS source to a project
                    dgolovin

                    max.andersen@jboss.com wrote:

                     

                    Note, once we have a stable location for src's then jboss tools would most likely need to implement that for our classpath containers so you don't have to do it manually for each jar.

                    Do you mean to have stable location somewhere available by http? Like maven repo or just site with stable structure for binaries/sources archives.

                    • 22. Re: Adding JBoss AS source to a project
                      maxandersen
                      max.andersen@jboss.com wrote:

                       

                      Beyond that the issue here is that JBoss AS should provide a src download that allows for easy matching of jar with source, one way would be if all the artifacts are in Maven repositories then we could attach the source automatically based on the Maven groupid and version.

                      I couldn't find a way to get sources for jars built with maven using eclipse, I think that's a good feature to havein m2eclipse or in JBossTools.

                       

                      m2eclipse has a preference that says if it should attempt to automatically download source and javadoc for jars that has it in the maven repo.

                      • 23. Re: Adding JBoss AS source to a project
                        maxandersen

                        I remember Rob mentioned plug-in in our lab component which has similar functionality and provides source lookup for *.src.zip files in selected for lookup folder. It can be adjusted to look inside *.jar files and after that we can handle looking into source archives inside selected source archive or file system. How, just by adding two types of source lookups: Eclipse's one for sources in external folder and our new one for archives in file system or archives inside archive.


                        Considering all above it looks doable for me

                        If we can create a lookup mechanism that gets delegated to that will match the current "source" distros we have that would be useful in any case.

                        • 24. Re: Adding JBoss AS source to a project
                          maxandersen

                          dgolovin wrote:

                           

                          max.andersen@jboss.com wrote:

                           

                          Note, once we have a stable location for src's then jboss tools would most likely need to implement that for our classpath containers so you don't have to do it manually for each jar.

                          Do you mean to have stable location somewhere available by http? Like maven repo or just site with stable structure for binaries/sources archives.

                          I mean if JBoss AS starts having their source available in standard maven location then we should utilize that as much as we can.

                          But m2eclipse doesn't control our classpath containers so we should update our classpath containers to either use the m2eclipse mechanism if present or replicate it to work even without m2eclipse configured/installed.

                          • 25. Re: Adding JBoss AS source to a project
                            henk53

                            max.andersen@jboss.com wrote:

                             

                            If your project is setup to locate sources correctly then any debug launches that refer to that project should also work - if not then please report a bug.

                             

                            Forgive my ignorance, but how do I exactly setup my project to locate sources correctly?

                             

                            Maybe strongly related, but by default the debugger also can't find the sources in my project itself. I'm really not doing anything special. Just a new download of Eclipse 3.5.1 Java EE edition. Installed nothing else but Jboss AS tools for that Eclipse version. Used clean new workspace. Then I created a new EAR project, added a JSF page with a backing bean. On the JSF page is basically only a h:outputText with EL referring to the bean. I put a break point in the bean and startup Jboss 5.1 via the Servers view. Load the page in my browser, the break-point hits and Eclipse/WTP/Jboss AS tools says it can't find the source of my bean.

                             

                            Using the debug view I then add both the EJB and web projects to the source lookup and then it can find the source of the .java file that is directly in the project.

                             

                            Is there anything I need to do in advance somewhere? It really strikes me as odd that ctrl-click just works when I create the bean, but then the debugger can't find the source after the break point hits. I tried on both my Mac at home and Ubuntu at work. A friend of my who also uses Jboss AS tools reported the same problem and also never found a solution.

                             

                            Am I missing something or is this a bug? I haven't yet tried with the default generic Jboss 5.0 runtime that is bundled with WTP though, so I'll try that too to see if it differs (although I really don't like the bundled Jboss runtime, since it's only capable of doing packaged deployments).

                            • 26. Re: Adding JBoss AS source to a project
                              dgolovin
                              All that sounds like you've got an issue for us to fix. I'll check that to confirm it.
                              • 27. Re: Adding JBoss AS source to a project
                                maxandersen

                                henk53 wrote:

                                 

                                max.andersen@jboss.com wrote:

                                 

                                If your project is setup to locate sources correctly then any debug launches that refer to that project should also work - if not then please report a bug.

                                 

                                Forgive my ignorance, but how do I exactly setup my project to locate sources correctly?


                                Attach sources to jars on your projects build path, incl. the jars in the AS classpath container.

                                • 28. Re: Adding JBoss AS source to a project
                                  dgolovin

                                  henk53 wrote:

                                   

                                  max.andersen@jboss.com wrote:

                                   

                                  If your project is setup to locate sources correctly then any debug launches that refer to that project should also work - if not then please report a bug.

                                   

                                  Using the debug view I then add both the EJB and web projects to the source lookup and then it can find the source of the .java file that is directly in the project.

                                  It looks like lunch configuration for server should be altered after project deployed/undployed to/from the server. WTP JBoss AS adapter does that but JBossTools JBossAS adapter doesn't.

                                  • 29. Re: Adding JBoss AS source to a project
                                    henk53

                                    max.andersen@jboss.com wrote:

                                     

                                    henk53 wrote:

                                     

                                    max.andersen@jboss.com wrote:

                                     

                                    If your project is setup to locate sources correctly then any debug launches that refer to that project should also work - if not then please report a bug.

                                     

                                    Forgive my ignorance, but how do I exactly setup my project to locate sources correctly?

                                    Attach sources to jars on your projects build path, incl. the jars in the AS classpath container.

                                     

                                    That's precisely what I do. I mean, what else is there to do?

                                     

                                    To be really clear, what I precisely do is:

                                     

                                    I right click on my project root, select properties and go to java build path -> Libraries. I unfold a jar file listed there, select "Source attachment" click edit, and locate the correct source jar.

                                     

                                    Alternatively, I unfold my project root in project explorer, go to Java Resources -> Libraries and select a jar for which I want to attach the source. I then right click the jar, select properties and go to Java Source Attachment, where I click Workspace... to locate my source jar.

                                     

                                    I figure both ways are just different means that yield the exact same end result; an entry in .classpath like:

                                     

                                    <classpathentry kind="lib" path="libraries/apache-commons/commons-beanutils-1.7.0.jar" sourcepath="libraries/apache-commons/commons-beanutils-src.jar"/>
                                    

                                     

                                    For the jars in the AS classpath container I pretty much do the same thing as mentioned above, with the small difference that I first need to unfold "Jboss 5.1 Runtime" and then attach the source to the jars listed beneath that using properties -> Java Source Attachment again.

                                     

                                    All of this is pretty basic and is what I've been doing for my Java SE projects in base Eclipse/JDT and in MyEclipse for years. Only in Eclipse/WTP/Jboss AS Tools that I recently started using, the debugger can't find the source after I've done the above. I can browser the source though by unfolding a jar, browsing it and then clicking on any .class file it contains. ctrl-clicking into it using the Java editor also works.

                                     

                                    I'm using JBossTools-3.1.0.CR1 btw. If this is not the expected behavior then it seems like a bug that is basically unrelated to the topic of this thread (an easy way to attach all the Jboss AS source code for a project).