7 Replies Latest reply on May 15, 2008 2:18 PM by Bruce Snyder

    Problem with JBI Maven Plugin: Cannot generate SA!

    Roger Joelsson Novice

       

      Hi all,

      I have a rather urgent issue: When I use the Maven archetype for ServiceMix JBI Service Assembly (SA) creation, no ZIP file is being produced!

      I've really tried out all resources, including debug prints, but cannot find what's wrong.

      I have a number of SU's, produced separately, and they work fine. The problem occurs when the SA pom.xml is being processed: A classes directory is created, containing the META-INF directory and the SU (ZIP) files. But no SA ZIP file is created! The only file I get is a lousy .jar file, containing the manifest and nothing else.

      The only Warning I get in the Maven log is:

      JAR will be empty - no content was marked for inclusion!

      Does ANYONE have any tips on how to proceed with this? ANY help I can get is welcome!

      Regards,

      Roger

       

       

        • 1. Re: Problem with JBI Maven Plugin: Cannot generate SA!
          Bruce Snyder Novice

          The information you have provided is minimal so I can only hazard a guess that you have not added any SUs as dependencies to the pom.xml file in the project for the SA. Have you added any SUs to the dependencies section of the SA pom.xml file? If you have already done this, please provide explicit details of the steps you've taken, including those for creating the SU projects.

           

          Bruce

          • 2. Re: Problem with JBI Maven Plugin: Cannot generate SA!
            Roger Joelsson Novice

            Bruce,

             

            Thanks for look at my urgent matter! Sorry for troubling you this way. Anyway, here is some more information and further questions. I would really appreciate if you could have a look on this.

             

            1) Yes, I've added the SU's as dependencies to the SA POM. I also noticed that I have to "maven install" these SU's in for the SA to build correctly. Is this correct?

             

            2) The SU's seem to build correctly, at least a ZIP and a JAR is being generated for each SU. The SU JAR (containing the xbean.xml and, if any, .class files) is though not included included in the ZIP (containing the jbi.xml only, basically), is this really correct? (Hence: Do I have to hot-deploy the JARs separately as I deploy the SA ZIP?)

             

            3) Continuing on 2 above, do you know if the SA ZIP file is supposed to be "self-contained", i.e. contain the jbi.xml, xbean.xml, any code jar files, and dependency jars? The SU's I get don't look like that, is that perhaps a sign of something being wrong?

             

            Listings follow below.

             

            My "root" pom.xml

             

             

             

             

            My SA pom.xml

             

              <-- Note: Added this tag, thought it would help (doesn't seem so, though)

            .   

             

             

            One of my SU POMs: An SU based on servicemix-file

             

            */

             

            One of my SU POMs: A servicemix-eip-based SU

             

            */

             

            Regards,

            Roger

             

            Edited by: roger on May 14, 2008 3:52 AM

             

            Edited by: roger on May 14, 2008 3:53 AM

             

            Edited by: roger on May 14, 2008 3:54 AM

            • 3. Re: Problem with JBI Maven Plugin: Cannot generate SA!
              Roger Joelsson Novice

              Hello again,

               

              We finally found the problem -- it proved that using the specific directory and outputDirectory tags under the build tag caused the problem! The generated SU ZIP-files became incomplete and the generate SA JAR became almost empty! After removing these tags, thus letting Maven default to the "target" directory, everything worked out fine!

               

              Question: Is this really expected behavior? Do you consider it as a bug?

               

              Regards,

              Roger

              • 4. Re: Problem with JBI Maven Plugin: Cannot generate SA!
                Bruce Snyder Novice

                 

                1) Yes, I've added the SU's as dependencies to the SA POM. I also noticed that I have to "maven install" these SU's in for the SA to build correctly. Is this correct?

                 

                 

                Yes, the SUs must be compiled first. Most typically this is done by creating a root POM from which Maven can build all the projects from a single 'mvn install' command. I see you have a root POM containing the modules. This should allow  'mvn install' on the each SU manually?

                 

                 

                2) The SU's seem to build correctly, at least a ZIP and a JAR is being generated for each SU. The SU JAR (containing the xbean.xml and, if any, .class files) is though not included included in the ZIP (containing the jbi.xml only, basically), is this really correct? (Hence: Do I have to hot-deploy the JARs separately as I deploy the SA ZIP?)

                 

                 

                SUs cannot be deployed to the ESB, only SAs can be deployed. The SU jar/zip files are automatically included in the SA (via the Maven build) and the SA jar/zip file is deployed to the ESB. The SU jar files should not be included in the SU jar/zip file as these two files are the same thing (a zip is a jar is a zip).

                 

                 

                3) Continuing on 2 above, do you know if the SA ZIP file is supposed to be "self-contained", i.e. contain the jbi.xml, xbean.xml, any code jar files, and dependency jars? The SU's I get don't look like that, is that perhaps a sign of something being wrong?

                 

                 

                The SA jar/zip file should contain the the SU jar/zip files that are included as dependencies in the SA POM. Also, the SA jar/zip file itself should have a jbi.xml file but not a xbean.xml file. The SUs are self-contained and the SA is just a jar/zip with a jbi.xml file and SUs.

                 

                 

                My SA pom.xml

                ..

                 <dependencies>
                 <dependency>
                 <groupId>junit</groupId>
                 <artifactId>junit</artifactId>
                 <version>3.8.1</version>
                 <scope>test</scope>
                 </dependency>
                 <dependency>
                 <groupId>my.group</groupId>
                 <artifactId>my-file-bc-su</artifactId>
                 <version>1.0-SNAPSHOT</version>
                 <type>jbi-service-unit</type> <-- Note: Added this tag, thought it would help (doesn't seem so, though)
                 </dependency>
                 <dependency>
                 <groupId>my.group</groupId>
                 <artifactId>my-bean-bc-su</artifactId>
                 <version>1.0-SNAPSHOT</version>
                 <type>jbi-service-unit</type>
                 </dependency>
                 <dependency>
                 <groupId>my.group</groupId>
                 <artifactId>eip-su</artifactId>
                 <version>1.0-SNAPSHOT</version>
                 <type>jbi-service-unit</type>
                 </dependency>
                 </dependencies>
                 <properties>
                 <servicemix-version>3.2.1</servicemix-version>
                 </properties>
                </project>
                

                 

                 

                Get rid of the  element. It's not needed. The SA POM should contain a dependency for each of your SUs, i.e., one dependency each for my-file-bc-su, my-bean-bc-su and eip-su (taken from the root POM).

                 

                At a glance, the SU POMs seem to be OK. It's difficult to understand the issue you're experiencing without actually compiling the code myself. Can you do a 'mvn clean', zip up the source and email it to me so I can have a look? (bruce DOT snyder AT iona DOT com)

                • 5. Re: Problem with JBI Maven Plugin: Cannot generate SA!
                  Bruce Snyder Novice

                  Yeah, I see those elements in the SA POM now:

                   

                  ...
                  <directory>dist</directory>
                  <outputDirectory>target.maven</outputDirectory>
                  ...
                  

                   

                  Like I said, without building the code myself and seeing the exact error, it's difficult to determine the cause. One thing that you can always use when debugging a build issue is adding a -X to the Maven command (e.g., 'mvn -X clean install') to output Maven's debug level logging. This can help in tracing a problem as much more detail is provided about the Maven phases of the build.

                   

                  Regarding those elements, I'm not sure how those got into the SA POM. I checked the servicemix-service-assembly for the FUSE ESB 3.3.1.0 and it contains no output elements. So those must have been manually added after that archetype was run and the SA project was created.

                   

                  Bruce

                  • 6. Re: Problem with JBI Maven Plugin: Cannot generate SA!
                    Roger Joelsson Novice

                    Hello again,

                     

                    That's true -- I've added the directory and sourceDirectory elements myself. It seemed to work, at least something was generated into those directories, though the generated files became incomplete. Perhaps the SU and SA archetypes do not support these tags?

                     

                    Regards,

                    Roger

                    • 7. Re: Problem with JBI Maven Plugin: Cannot generate SA!
                      Bruce Snyder Novice

                      I know that the ServiceMix archetypes don't have anything to do with the output as that's a product of the Maven MOJO framework. I'm not sure what would be going wrong though. I recommend just letting Maven output everything to the target dir.

                       

                      Bruce