7 Replies Latest reply on Mar 31, 2008 3:22 AM by maxandersen

    How does -test project reference dependent libraries?

    cpopetz

      So after many hours, I'm finally grokking how the four projects work together, and I like it :)

      But I don't understand how the -test project is supposed to pick up its jar dependencies for things that live in .ear/lib. The -ejb and -war projects get the "Ear Libraries" magic library that picks up anything referenced in MANIFEST.MF's Class-path, because the -ear project references them as J2EE Module Dependencies...but not so the -test project.

      So do I have to add those jars to the -test project's lib/ dir, i.e. do I have to manage two identical sets of jars?

      Thanks!
      -Clint

        • 1. Re: How does -test project reference dependent libraries?

          I think that Eclipse knows about more stuff than what is in META-INF. I think it has some metadata elsewhere that tells it about dependencies.

          • 2. Re: How does -test project reference dependent libraries?
            maxandersen

            the test project knows about it because it has the War project on its eclipse classpath...and that war project has a EAR libraries classpath container which is picking up the EAR content.

            simple, eh ? :)

            • 3. Re: How does -test project reference dependent libraries?
              cpopetz

              By default the jboss-tools generated war project within an ear project doesn't have the EAR libraries checked as exported on the "Order / Export" tab of the Java Build Path settings. Should it be, so that the test project picks up the EAR libs when it runs?

              • 4. Re: How does -test project reference dependent libraries?
                cpopetz

                Also...while I agree it's simple, it's a little problematic. Because I have ejb jars in my ear which need to reference libs in the ear which the WAR doesn't need to reference. But to make the test project able to test the code in the EJB jars, I have to make the WAR reference those EJB libs in MANIFEST.MF.

                • 5. Re: How does -test project reference dependent libraries?
                  maxandersen

                  huh ? the ejb project is also on the war as an dependency.

                  Shuold just work - if not please isolate it down to a very simple setup that I can reproduce and put it in jira.

                  thanks.

                  • 6. Re: How does -test project reference dependent libraries?
                    cpopetz

                    There are two issues here, both of which may be too specific to more complicated EAR deployments to be worth fixing in the projects that jboss tools generates in its wizard.

                    (1) I'm using junit rather than testng, because the latter's output leaves much to be desired, and we have testing tools that work with junit's xml output. Junit respects the "Exported" checkbox set in the the "Order and Export" section of the Java Build Path. Testng must not. Because if I don't check to export the EAR directories to dependent projects in the build path for the WAR, then the tests running from the test project don't find the ear directories. The jboss tools don't check this box by default.

                    (2) I have an EJB that depends on Utility jars in the Ear. The EJB lists those in its Manifest.MF. The WAR _doesn't_ list those in its Manifest.MF, because it doesn't need them, and it is sometimes packaged in a different EAR without those libs present. Now, in order to have the test project find the libs on the classpath in order to test the EJB module, I have to include those utility libs in the MANIFEST.MF of the WAR, so that they get picked up by the test project. Does that make sense?

                    So I guess what I'd like to see: The test project is testing dependent EJB modules and the WAR module. The latter both pick up Utility Jar dependencies through Manifest.MF and EarContent, via that whizzy "EAR Libraries" thing. It would be nice if the test project did that as well.

                    I'm new to the WST tools; for the past couple years they were too broken to really use, in my opinion. So perhaps the above comments reflect my own ignorance of how to best use these tools to manage dependencies between projects.

                    • 7. Re: How does -test project reference dependent libraries?
                      maxandersen

                       

                      "cpopetz" wrote:

                      (1) I'm using junit rather than testng, because the latter's output leaves much to be desired, and we have testing tools that work with junit's xml output. Junit respects the "Exported" checkbox set in the the "Order and Export" section of the Java Build Path. Testng must not. Because if I don't check to export the EAR directories to dependent projects in the build path for the WAR, then the tests running from the test project don't find the ear directories. The jboss tools don't check this box by default.


                      This is disturbing if true ;(
                      But testng must really be doing funny things to get the classpath if it gets *more* than what junit does. Could you help us by reducing this to a simple testcase and submit it towards the testng project and show the diference in behavior ?

                      note: you can see the actual used classpath by right clicking on the process in the debug launch view and select Properties.


                      So I guess what I'd like to see: The test project is testing dependent EJB modules and the WAR module. The latter both pick up Utility Jar dependencies through Manifest.MF and EarContent, via that whizzy "EAR Libraries" thing. It would be nice if the test project did that as well.


                      This is what actually should just be happening....could you create a minimal testcase/project and submit it to jira so we can be sure we are actually doing the same thing ? Thanks.