ServiceMix
  1. ServiceMix
  2. SM-1957

jbi-maven-plugin should not complains when calling compile goal for a service-assembly

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: jbi-maven-plugin-4.3
    • Fix Version/s: jbi-maven-plugin-4.6
    • Component/s: tooling
    • Labels:
      None
    • Environment:

      Using maven 3.0-beta1, but manifests itself with maven 2.2.1

      Description

      Hello,

      Problem

      When calling mvn compile in a project tree and one of the project is an SA, I get the following error:

      [ERROR] Failed to execute goal org.apache.servicemix.tooling:jbi-maven-plugin:4.3:generate-jbi-service-assembly-descriptor (default-generate-jbi-service-assembly-descriptor) on project scenario1-sa: Execution default-generate-jbi-service-assembly-descriptor of goal org.apache.servicemix.tooling:jbi-maven-plugin:4.3:generate-jbi-service-assembly-descriptor failed: String index out of range: -1 -> [Help 1]
      

      The errors seems to be coming from GenerateServiceAssemblyDescriptorMojo.java, line 213, for the following part:

      fileName = fileName.substring(0, fileName.lastIndexOf('.')) + ".zip";
      

      This piece of code seems to try to generate the jbi.xml file using the name of the files of the SU plugins generated by the goal package.

      Expected Result

      I would expect jbi-maven-plugin, either not to try to generate the jbi.xml file on compile, or to generate it without using the information about things that are produced by the goal package.

      Rational for using compile

      1. because I want to do it
      2. to compile all the projects in a project tree without bothering
      3. to run tests !!
      4. to use the project in Eclipse with m2eclipse (Eclipse the goal compile from time to time and the error appears in its console)

      Thank you

        Activity

        Victor created issue -
        Jeff Turner made changes -
        Field Original Value New Value
        Project Import Sat Nov 27 00:46:19 EST 2010 [ 1290836779991 ]
        Hide
        Gavin Scott added a comment -

        I also see this when building an SA with maven3 using the compile goal in a nested module project like the one described here:

        http://servicemix.apache.org/4-beginner-web-services-with-servicemix-and-cxf.html

        Running "mvn3 clean compile" from the top-level of the attached tutorial-wsdl-cxf-service.tar.gz demonstrates the problem. Problem also occurs when building with m2eclipse 0.12

        In these cases the SU artifact filename is "classes" instead of something like "my-cxf-bc-su-1.0-SNAPSHOT.jar" which causes the fileName.lastIndexOf('.') shown above to fail.

        The attached jbi-maven-plugin-su-filename.patch fixes this by generating the .zip filename based on artifact id and version rather than mangling the SU artifact .jar name. This is not a perfect fix because it fails if the serviceUnitName has been overridden. See my-cxf-se-su/pom.xml in attached tarball for an example. However, that case is broken in the current jbi-maven-plugin as well.

        Show
        Gavin Scott added a comment - I also see this when building an SA with maven3 using the compile goal in a nested module project like the one described here: http://servicemix.apache.org/4-beginner-web-services-with-servicemix-and-cxf.html Running "mvn3 clean compile" from the top-level of the attached tutorial-wsdl-cxf-service.tar.gz demonstrates the problem. Problem also occurs when building with m2eclipse 0.12 In these cases the SU artifact filename is "classes" instead of something like "my-cxf-bc-su-1.0-SNAPSHOT.jar" which causes the fileName.lastIndexOf('.') shown above to fail. The attached jbi-maven-plugin-su-filename.patch fixes this by generating the .zip filename based on artifact id and version rather than mangling the SU artifact .jar name. This is not a perfect fix because it fails if the serviceUnitName has been overridden. See my-cxf-se-su/pom.xml in attached tarball for an example. However, that case is broken in the current jbi-maven-plugin as well.
        Hide
        Gavin Scott added a comment -

        Project demonstrating problem and patch to fix.

        Show
        Gavin Scott added a comment - Project demonstrating problem and patch to fix.
        Gavin Scott made changes -
        Attachment tutorial-wsdl-cxf-service.tar.gz [ 12465660 ]
        Attachment jbi-maven-plugin-su-filename.patch [ 12465661 ]
        Freeman Fang made changes -
        Assignee Jean-Baptiste Onofré [ jb@nanthrax.net ] Freeman Fang [ ffang ]
        Freeman Fang made changes -
        Status Open [ 1 ] In Progress [ 3 ]
        Hide
        Freeman Fang added a comment -

        Hi Gavin,

        We can simply generate fileName with artifactId and version when use compile to fix this issue.

        About the serviceUnitName doesn't work, it's actually another issue, just create SM-2102[1] to track it, thanks for pointing it out.

        Also thanks for your patch anyway.

        [1]https://issues.apache.org/jira/browse/SM-2102

        Freeman

        Show
        Freeman Fang added a comment - Hi Gavin, We can simply generate fileName with artifactId and version when use compile to fix this issue. About the serviceUnitName doesn't work, it's actually another issue, just create SM-2102 [1] to track it, thanks for pointing it out. Also thanks for your patch anyway. [1] https://issues.apache.org/jira/browse/SM-2102 Freeman
        Show
        Freeman Fang added a comment - commit fix http://svn.apache.org/viewvc?rev=1141383&view=rev
        Freeman Fang made changes -
        Status In Progress [ 3 ] Resolved [ 5 ]
        Fix Version/s jbi-maven-plugin-4.6 [ 12316408 ]
        Resolution Fixed [ 1 ]
        Transition Time In Source Status Execution Times Last Executer Last Execution Date
        Open Open In Progress In Progress
        369d 13h 46m 1 Freeman Fang 30/Jun/11 03:52
        In Progress In Progress Resolved Resolved
        1h 1 Freeman Fang 30/Jun/11 04:52

          People

          • Assignee:
            Freeman Fang
            Reporter:
            Victor
          • Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development