1 2 Previous Next 17 Replies Latest reply on Aug 31, 2004 6:20 AM by Thomas Heute

    setting up nukes in Jboss/Eclipse IDE

    xqidtm Newbie

      I'd like to set up nukes in the Jboss/Eclipse IDE so I can make modifications to the source code to fit our application's needs. Has anybody done it? Your information is greatly appreciated. The ideal scenario is to keep nukes' directory structure so I can take advantage of nukes' build scripts to deploy the application after I make my changes. What I found challenging is how to import the nukes directory structure into Eclipse, and tell it that the java source code is located in the module-name/src/main in each sub directory.

      Many thanks for your help.

        • 1. Re: setting up nukes in Jboss/Eclipse IDE
          Thomas Heute Master

          Arf sorry i forgot about the stripped tags...

          "theute" wrote:
          First you should modify your .classpath with Eclipse closed as i think Eclipse will replace your .classpath by the one it has in memory. So check that your .classpath has not been modified

          I only use 1 project and 1 classpath (in the root directory of the project) Be careful with the different views, Java and Resource.

          I am not sure of the perfect way but this should work (i always do from CVS otherwise i couldn't find any way to use the CVS features of Eclipse)

          --> Create a new Java project (any project name, Create in workspace (or not it shouldn't matter, create separate source and output folders) . you can click on finish at the first screen
          --> right click on the project and choose import
          --> pick file system
          --> go inside the directory nukes (where there is build, common, bb, ...
          -->select it (the main directory) and choose "Create selected folders only"
          Now you should have in the resource view:
          Projectname
          > bb
          > build
          > common
          > ...
          > tools
          > .classpath
          > .project

          And in Java view:
          > src
          > JRE System Library
          > bb
          ...
          > tools

          Now you want to declare bb/src/main, common/src/main, distrib/src/main... as sources directories.

          What you can do is go in the properties of the project then choose the Java Build Path, and "Source" tab and click to add your folders one by one. If you do that it will update your .classpath like this:
           <classpathentry kind="src" path="nukes/src/main"/>
           <classpathentry kind="src" path="common/src/main"/>
           <classpathentry kind="src" path="bb/src/main"/>
          

          Once you did that Eclipse will complain about missing libraries. Here starts the boring job to find which libraries it needs. You can look at the message and fix one by one the missing libraries by adding them in the "Libraries" tab and click on "Add external jars".

          By doing that Eclipse will update the .classpath like this: (there are much more)
           <classpathentry kind="lib" path="/home/theute/jboss-3.2/build/output/jboss-3.2.3/lib/commons-httpclient.jar"/>
           <classpathentry kind="lib" path="/home/theute/jboss-3.2/build/output/jboss-3.2.3/lib/commons-logging.jar"/>
           <classpathentry kind="lib" path="/home/theute/jboss-3.2/build/output/jboss-3.2.3/lib/concurrent.jar"/>
           <classpathentry kind="lib" path="/home/theute/jboss-3.2/build/output/jboss-3.2.3/lib/getopt.jar"/>
           <classpathentry kind="lib" path="/home/theute/jboss-3.2/build/output/jboss-3.2.3/lib/gnu-regexp.jar"/>
           <classpathentry kind="lib" path="/home/theute/jboss-3.2/build/output/jboss-3.2.3/lib/jboss-boot.jar"/>
          


          Now you are ready to use Eclipse.

          To build you should still use the build.xml

          I am not expert of Eclipse, there is probably better to do as my classes are compiles twice, once by Eclipse (in a wrong directory) and once by ant.

          I just started to play with JBoss IDE but breaks too often for me :(

          Good luck !



          • 2. Re: setting up nukes in Jboss/Eclipse IDE
            Nick Temple Newbie

             

            What I found challenging is how to import the nukes directory structure into Eclipse, and tell it that the java source code is located in the module-name/src/main in each sub directory.


            Take a look at http://jboss.org/wiki/Wiki.jsp?page=UsingEclipse
            The .classpath files do exactly that.

            I just started with Eclipse, here is what I can remember doing:

            After downloading & unzipping a snapshot, I set JBOSS_NUKES and JBOSS_HOME to the correct paths. I then started Eclipse, went to File | New, borwse to the "common" sub-directory, and click finish.

            Repeat for "nukes" and other modules (start with only 1 at first).

            Close Eclipse (?needed)

            Download the appropriate files from the resource above to get you started, rename them as .classpath, and put them in the appropriate directories. If this isn't clear, I can expand.

            You'll then need to restart Eclipse, then add a few .jar's and possibly fix a few paths (Project | Properties | Java Build Path ) to get everything to compile. I found the ant build.xml (and it's includes) helpful pointers in where to find the various required jars.

            Specifically, I remember nukes needing "jboss.jar" for some reason.

            If this works for you, let me know -- I'll clean it up and add it the Wiki.



            • 3. Re: setting up nukes in Jboss/Eclipse IDE
              jae Master

              the .classpath files that are attached to that wiki page may be a little out of date b/c additional libraries may have been required since i published those.

              you can use them as a good starting point. eclipse does an excellent job of telling you what classes it can't find, so after that, it's just a matter of figuring out which jboss jar has those classes and adding them to the classpath.

              • 4. Re: setting up nukes in Jboss/Eclipse IDE
                xqidtm Newbie

                 

                I then started Eclipse, went to File | New, borwse to the "common" sub-directory, and click finish.


                I'm not clear about what you're doing here. Perhaps I didn't state my question clearly. When you create a new project in Eclipse, do you specify a top level 'src' folder to hold all the source code? Or do you add the src/main folder in each module on the build path? I'm new to Eclipse. A viki page detailing how to create a new project in Eclipse, port the nukes code into it, build and deploy the application would be extremely helpful.

                Thank you very much for your help.

                • 5. Re: setting up nukes in Jboss/Eclipse IDE
                  jae Master

                  start out by performing a build of the project on the command line.

                  after that completes, open up eclispe and create a new project. once you tell eclipse where the project's home directory is, it should be smart enough to automatically pick up the necessary directories that contain the xdoclet generated source, and the "regular" source files.

                  if you are trying to create a brand new project, you have two options.

                  1) create the directory structure outside of eclipse, and drop a .java file into one of the directories so eclipse automatically finds it.

                  2) manually add the folders to the classpath by right clicking on the project, choosing properties, then "build path" and manually add the folder by clicking "Add folder"

                  if you created a "src/main" directory under your project, then the "Add folder" option will let you drill down into that specific folder so it's added to the classpath.

                  there are plenty of eclipse tutorials online that cover how to create a new project.

                  • 6. Re: setting up nukes in Jboss/Eclipse IDE
                    Mark Johansson Newbie

                    Hi, guys, have anybody tried the suggestions?

                    referring to nick's steps, do I need to specify $JBOSS_NUKES to be my project directory? then I go to $JBOSS_NUKES/path-to-{common,nukes,other-modules} to place the .classpath?

                    which .jar that I need? can you refer me to a web-site that show step-by-step how to write and deploy customized modules?

                    I refer to the "onjava article"

                    but it never showed the full source code (import statements, lib/jar files for the classpath) and the directory that I should deploy the module. do I need to explode nukes.ear and package it again?

                    • 7. Re: setting up nukes in Jboss/Eclipse IDE
                      Thomas Heute Master

                      You only need 1 .classpath per project, the easiest thing to do is to put all nukes as 1 project (including all modules). When you create a project Eclipse creates a .classpath for you. In the wiki page it's explained

                      If you have only the .ear then you have only the binaries you need to take the sources (so you can look at how it is made). (i am preparing the packages for 1.1rc3 if you wait some more or even better take it from the CVS)

                      I can give you my .classpath if you need.

                      When i will have extra time i may update the Eclipse wiki page and maybe provide .classpath with the CVS

                      • 8. Re: setting up nukes in Jboss/Eclipse IDE
                        Mark Johansson Newbie

                        hi theute,

                        thanks for your classpath. if you don't mind i'd like to try 1st.

                        i'm using eclipse3.0 200406251208 with jboss-ide plugin

                        what's wrong with these steps?
                        - created a new project : file->new->'java project'
                        source folder : Jnukes/src
                        output folder: Jnukes/bin

                        - selected file->new->folder->
                        selected path_to_/nukes-1.0.0-src to give the following hierarchy

                        Jnukes
                        |- src
                        |-JRE_LIB
                        |-nukes-1.0.0-src

                        - selected windows->preferences->java->build path->classpath variables
                        JBOSS_HOME=/opt/jboss-3.2.3
                        JBOSS_NUKES=/home/programming/jnukes/nukes-1.0.0-src

                        - cp common-classpath.html $JBOSS_NUKES/common/.classpath
                        cp nukes-classpath.html $JBOSS_NUKES/nukes/.classpath
                        cp template-classpath.html $JBOSS_NUKES/template/.classpath
                        cp .classpath $JBOSS_NUKES/.classpath

                        those files were downloaded from "http://www.jboss.org/wiki/Wiki.jsp?page=SettingUpClasspaths"

                        - right click on Jnukes folder to refresh the view. should I see some library there?

                        • 9. Re: setting up nukes in Jboss/Eclipse IDE
                          Thomas Heute Master

                          First you should modify your .classpath with Eclipse closed as i think Eclipse will replace your .classpath by the one it has in memory. So check that your .classpath has not been modified

                          I only use 1 project and 1 classpath (in the root directory of the project) Be careful with the different views, Java and Resource.

                          I am not sure of the perfect way but this should work (i always do from CVS otherwise i couldn't find any way to use the CVS features of Eclipse)

                          --> Create a new Java project (any project name, Create in workspace (or not it shouldn't matter, create separate source and output folders) . you can click on finish at the first screen
                          --> right click on the project and choose import
                          --> pick file system
                          --> go inside the directory nukes (where there is build, common, bb, ...
                          -->select it (the main directory) and choose "Create selected folders only"
                          Now you should have in the resource view:
                          Projectname
                          > bb
                          > build
                          > common
                          > ...
                          > tools
                          > .classpath
                          > .project

                          And in Java view:
                          > src
                          > JRE System Library
                          > bb
                          ...
                          > tools

                          Now you want to declare bb/src/main, common/src/main, distrib/src/main... as sources directories.

                          What you can do is go in the properties of the project then choose the Java Build Path, and "Source" tab and click to add your folders one by one. If you do that it will update your .classpath like this:





                          Once you did that Eclipse will complain about missing libraries. Here starts the boring job to find which libraries it needs. You can look at the message and fix one by one the missing libraries by adding them in the "Libraries" tab and click on "Add external jars".

                          By doing that Eclipse will update the .classpath like this: (there are much more)







                          Now you are ready to use Eclipse.

                          To build you should still use the build.xml

                          I am not expert of Eclipse, there is probably better to do as my classes are compiles twice, once by Eclipse (in a wrong directory) and once by ant.

                          I just started to play with JBoss IDE but breaks too often for me :(

                          Good luck !

                          • 10. Re: setting up nukes in Jboss/Eclipse IDE
                            Mark Johansson Newbie

                            hi theute,

                            i've followed your steps but ran into problems not described in your reply.

                            these were the steps i ran:
                            - make sure eclipse not running, prepare the classpath

                            cp common-classpath.html $JBOSS_NUKES/common/.classpath
                            cp nukes-classpath.html $JBOSS_NUKES/nukes/.classpath
                            cp template-classpath.html $JBOSS_NUKES/template/.classpath
                            cp .classpath $JBOSS_NUKES/.classpath

                            based on the wiki, the last .classpath is required - is this in violation to your 'one project one classpath' description?


                            --> Create a new Java project (any project name, Create in workspace (or not it shouldn't matter, create separate source and output folders) . you can click on finish at the first screen
                            --> right click on the project and choose import
                            --> pick file system
                            --> go inside the directory nukes (where there is build, common, bb, ...
                            -->select it (the main directory) and choose "Create selected folders only"
                            Now you should have in the resource view:
                            Projectname
                            > bb
                            > build
                            > common
                            > ...
                            > tools
                            > .classpath
                            > .project

                            And in Java view:
                            > src
                            > JRE System Library
                            > bb
                            ...
                            > tools

                            Now you want to declare bb/src/main, common/src/main, distrib/src/main... as sources directories.

                            What you can do is go in the properties of the project then choose the Java Build Path, and "Source" tab and click to add your folders one by one. If you do that it will update your .classpath like this:


                            - i imported the dir devel/nukes-1.0.0-src/ like your outline
                            the diretories bb/src/main, ... were created automatically, sightly different from what you had.

                            - windows->preferences->java->build path, i added JBOSS_3_2_3 to point to my jboss server /opt/appservers/jboss-3.2.3_nukes-1.0.0/ - looks like this classpath is required by the classpath files given in the wiki

                            got this error message:

                            Project Nukes is missing required library: Nukes/thirdparty/apache/commons/lib/commons-fileupload.jar (Nukes is my project name)

                            solved by:
                            mv thirdparty/apache-commons/lib/commons-fileupload-1.0-beta-1.jar thirdparty/apache-commons/lib/commons-fileupload.jar

                            got error messages:
                            Project nukes is missing required source folder: bb/output/gen/classes, ... common/output/gen/classes

                            i went to Nukes properties->Source, those folders have (will be generated) remarks
                            upon clicking OK, eclipse indicated it was building the workspace

                            This is where the problem begins, i got lots of error messages regarding ejb interfaces:

                            The import org.jboss.nukes.addons.modules.adminmessages.ejb.AdminMessagesEJBLocal cannot be resolved AdminMessagesModule.java Nukes/adminmessages/src/main/org/jboss/nukes/addons/modules/adminmessages line 21

                            The import org.jboss.nukes.addons.modules.adminmessages.ejb.AdminMessagesEJBLocalHome cannot be resolved AdminMessagesModule.java Nukes/adminmessages/src/main/org/jboss/nukes/addons/modules/adminmessages line 22

                            adminMessagesHome cannot be resolved AdminMessagesModule.java Nukes/adminmessages/src/main/org/jboss/nukes/addons/modules/adminmessages line 81

                            homesRW.post cannot be resolved or is not a field BBModule.java Nukes/bb/src/main/org/jboss/nukes/addons/modules/bb line 415

                            homesRW.forum cannot be resolved or is not a field BBModule.java Nukes/bb/src/main/org/jboss/nukes/addons/modules/bb line 431

                            ForumEJBLocal cannot be resolved or is not a type BBModule.java Nukes/bb/src/main/org/jboss/nukes/addons/modules/bb line 433

                            CategoryEJBLocal cannot be resolved or is not a type BBModule.java Nukes/bb/src/main/org/jboss/nukes/addons/modules/bb line 1150

                            ForumEJBLocal cannot be resolved or is not a type BBModule.java Nukes/bb/src/main/org/jboss/nukes/addons/modules/bb line 1154

                            i guess i've written all possible types of errors without being too verbose

                            looks like i have 2 problems:
                            - the ejb interfaces
                            - standard import statements

                            1. for the ejb interfaces, i went to the source codes but they don't have xdoclet so how do you generate them? do i got the right import? should i import 'nukes-1.1.0-mysql-RC2/' or some other sources?

                            2. for standard import statements. like 'import java.util.Collections' , i'm not sure why. JRE System Library (1.4.2_04) is there.

                            Have you met these problems before? thanks for you replies.

                            • 11. Re: setting up nukes in Jboss/Eclipse IDE
                              Thomas Heute Master

                              You shouldn't use the classpath of the wiki page, and don't have to rename the jar files, if Eclipse complained it's because Nukes/thirdparty/apache/commons/lib/commons-fileupload.jar is declared in the .classpath.

                              If you follow my steps, without anything else (not using .classpath) it should work.

                              Nevertheless it seems that you solved problems so if you want to start from that point:
                              1) just build the project by running build.sh in Nukes/build the EJB classes will compile and you won't have the "cannot be resolved error messages" .
                              2) i don't know why you would have standard import errors

                              I would advise to start from scratch (plus you can use the Nukes-1.1.0-RC3-src package that we put online yesterday night available on the project page.
                              But that time, forget the wiki page and the .classpath just follow my instructions (and build the whole stuff), i tried it while explaining it here, so it must work for you too.

                              PS: i meant that i have only 1 classpath, because i have only 1 project for nukes-1.1, some could have 1 project for core, 1 for bb, 1 for news ... (and 1 classpath per project)

                              Good luck

                              • 12. Re: setting up nukes in Jboss/Eclipse IDE
                                Mark Johansson Newbie

                                hi theute,

                                thanks a lot for your help, looks like it's getting closer to wrap this up. down with 2 lines of error messages after tinkering for so long.

                                this structure is obtained using Nukes-1.1.0-RC3-src:
                                - Nukes
                                |-src
                                |-bb/src/main
                                |-distrib/src/main
                                |-downloads/src/main
                                |-fag/src/main
                                |-news/src/main
                                |-nukes/src/main
                                |-permission/src/main
                                |-rss/src/main
                                |-emplate/src/main
                                |-JRE_LIB
                                |- commons-httpclient.jar
                                |- commons-loggin.jar
                                |- concurrent.jar
                                |- etopt.jar
                                |- gnu-regex.jar
                                |- jboss-boot.jar
                                |- jboss-jmx.jar
                                |- jboss-system.jar
                                |- jdom.jar
                                |- log4j-boot.jar
                                |- webdavlib.jar
                                |- xercesImpl.jar
                                |- xml-apis.jar
                                |- lucene.jar
                                |- jboss.jar
                                |- log4j.jar
                                |- snmpTrapAppender.jar
                                |- javax.servlet.jar
                                |- bb [2]
                                |- build
                                \- build.xml [1]
                                |- ..
                                |- tools
                                |- lib

                                where lib is where i imported the *.jar before i added them to the project->properties->java build path.

                                then i ran the build.xml (marked [1] above). got some 'unexplained errors'. solved by restarting eclipse.

                                these are the error messages:


                                The type javax.transaction.Transaction cannot be resolved. It is indirectly referenced from required .class files BBTools.java Nukes/bb/src/main/org/jboss/nukes/addons/modules/bb line 0 August 22, 2004 2:59:01 PM

                                The project was not built since its build path is incomplete. Cannot find the class file for javax.transaction.Transaction. Fix the build path then try building this project Nukes August 22, 2004 2:59:01 PM


                                now 'bb/src/main/org.jboss.nukes.addons.modules.bb/BBTools.java' and 'bb/src' are marked with "read x"

                                i went to BBTools.java:

                                import org.jboss.nukes.addons.modules.bb.ejb.ForumEJBLocal;
                                import org.jboss.nukes.addons.modules.bb.ejb.CategoryEJBLocal;
                                import org.jboss.nukes.addons.modules.bb.ejb.CategoryEJBLocalHome;
                                import org.jboss.nukes.addons.modules.bb.ejb.ForumEJBLocalHome;

                                import javax.ejb.EJBLocalObject;
                                import javax.ejb.EJBLocalHome;

                                - the import org.jboss.nukes.ForumEjbLocal .. cannot be resolved
                                but if i go to bb/output/classes/org/jboss/jnukes/addons/modules/bb/ejb/ (marked [2])
                                those *.class files are there.
                                - the error on javax.ejb.* is even puzzling, i've added jboss.jar in the classpath


                                But that time, forget the wiki page and the .classpath just follow my instructions (and build the whole stuff), i tried it while explaining it here, so it must work for you too.


                                really appreciate to know how you pulled this off.

                                • 13. Re: setting up nukes in Jboss/Eclipse IDE
                                  Mark Johansson Newbie

                                  More background info ( i gather from online forums these may matter ):

                                  i imported the *.jar from jboss-3.2.3/ and nukes-1.1.0-RC3-src/ whenever possible.

                                  under windows->preferences->ant->runtime->'ant home entries(default)' i have
                                  path_to_eclipse-SDK-3.0/plugins/org.apache.ant_1.6.1/lib/*.jar

                                  • 14. Re: setting up nukes in Jboss/Eclipse IDE
                                    Mark Johansson Newbie

                                    just added jboss.jar into the classpath. the error messages on javax.ejb.* and javax.transactions.* are gone, those that still remain are:

                                    mport org.jboss.nukes.addons.modules.bb.ejb.ForumEJBLocal;
                                    import org.jboss.nukes.addons.modules.bb.ejb.CategoryEJBLocal;
                                    import org.jboss.nukes.addons.modules.bb.ejb.CategoryEJBLocalHome;
                                    import org.jboss.nukes.addons.modules.bb.ejb.ForumEJBLocalHome;

                                    the latest structure structure is obtained using Nukes-1.1.0-RC3-src:
                                    - Nukes
                                    |-src
                                    |-bb/src/main
                                    |-distrib/src/main
                                    |-downloads/src/main
                                    |-fag/src/main
                                    |-news/src/main
                                    |-nukes/src/main
                                    |-permission/src/main
                                    |-rss/src/main
                                    |-emplate/src/main
                                    |-JRE_LIB
                                    |- commons-httpclient.jar
                                    |- commons-loggin.jar
                                    |- concurrent.jar
                                    |- etopt.jar
                                    |- gnu-regex.jar
                                    |- jboss-boot.jar
                                    |- jboss-jmx.jar
                                    |- jboss-system.jar
                                    |- jdom.jar
                                    |- log4j-boot.jar
                                    |- webdavlib.jar
                                    |- xercesImpl.jar
                                    |- xml-apis.jar
                                    |- lucene.jar
                                    |- jboss.jar
                                    |- log4j.jar
                                    |- snmpTrapAppender.jar
                                    |- javax.servlet.jar
                                    |- bb [2]
                                    |- build
                                    \- build.xml [1]
                                    |- ..
                                    |- tools
                                    |- lib
                                    |- jboss.jar -- NEW

                                    1 2 Previous Next