ServiceMix Kernel
  1. ServiceMix Kernel
  2. SMX4KNL-217

Enhance features maven plugin to support deployment / undeployment of features, html generation and create a few archetypes

    Details

    • Type: New Feature New Feature
    • Status: In Progress
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Labels:
      None

      Description

      Enhance the features maven plugin (http://svn.apache.org/repos/asf/servicemix/maven-plugins/features-maven-plugin) to support :

      1) Deployment / undeployment of features,
      2) Generate html page about features : see http://fusesource.com/forums/message.jspa?messageID=2005#2005 for the suggestion
      3) Creation a few archetypes:

      • one for creating a custom smx kernel distribution + a set of
        features (like what we do for our distributions).
      • one for creating a feature descriptor automatically generated
        using the maven plugin we already have + upload in the maven repo. Ideally, the descriptor should be created from the user pom.xml profile file or (pom.xml files if the user has created a parent pom.xml with modules)
      • one for creating a manually written feature descriptor + upload in
        the maven repo

      The two last archetypes should reference our maven plugin so that they
      could be easily installed / uninstalled to a running (or not) smx4
      kernel instance using maven.

      Remark : this ticket has been created following discussions exchanged in the forum of SMX : http://www.nabble.com/forum/ViewPost.jtp?post=22285345&framed=y

        Activity

        Charles Moulliard created issue -
        Hide
        Charles Moulliard added a comment -

        add reference to the forum link from which the ideas come

        Show
        Charles Moulliard added a comment - add reference to the forum link from which the ideas come
        Charles Moulliard made changes -
        Field Original Value New Value
        Description Enhance the features maven plugin (http://svn.apache.org/repos/asf/servicemix/maven-plugins/features-maven-plugin) to support :

        1) Deployment / undeployment of features,
        2) Generate html page about features : see http://fusesource.com/forums/message.jspa?messageID=2005#2005 for the suggestion
        3) Creation a few archetypes:

          - one for creating a custom smx kernel distribution + a set of
        features (like what we do for our distributions)
          - one for creating a feature descriptor automatically generated
        using the maven plugin we already have + upload in the maven repo
          - one for creating a manually written feature descriptor + upload in
        the maven repo

        The two last archetypes should reference our maven plugin so that they
        could be easily installed / uninstalled to a running (or not) smx4
        kernel instance using maven.
        Enhance the features maven plugin (http://svn.apache.org/repos/asf/servicemix/maven-plugins/features-maven-plugin) to support :

        1) Deployment / undeployment of features,
        2) Generate html page about features : see http://fusesource.com/forums/message.jspa?messageID=2005#2005 for the suggestion
        3) Creation a few archetypes:

          - one for creating a custom smx kernel distribution + a set of
        features (like what we do for our distributions)
          - one for creating a feature descriptor automatically generated
        using the maven plugin we already have + upload in the maven repo
          - one for creating a manually written feature descriptor + upload in
        the maven repo

        The two last archetypes should reference our maven plugin so that they
        could be easily installed / uninstalled to a running (or not) smx4
        kernel instance using maven.

        Remark : this ticket has been created following discussions exchanged in the forum of SMX : http://www.nabble.com/forum/ViewPost.jtp?post=22285345&framed=y
        Charles Moulliard made changes -
        Description Enhance the features maven plugin (http://svn.apache.org/repos/asf/servicemix/maven-plugins/features-maven-plugin) to support :

        1) Deployment / undeployment of features,
        2) Generate html page about features : see http://fusesource.com/forums/message.jspa?messageID=2005#2005 for the suggestion
        3) Creation a few archetypes:

          - one for creating a custom smx kernel distribution + a set of
        features (like what we do for our distributions)
          - one for creating a feature descriptor automatically generated
        using the maven plugin we already have + upload in the maven repo
          - one for creating a manually written feature descriptor + upload in
        the maven repo

        The two last archetypes should reference our maven plugin so that they
        could be easily installed / uninstalled to a running (or not) smx4
        kernel instance using maven.

        Remark : this ticket has been created following discussions exchanged in the forum of SMX : http://www.nabble.com/forum/ViewPost.jtp?post=22285345&framed=y
        Enhance the features maven plugin (http://svn.apache.org/repos/asf/servicemix/maven-plugins/features-maven-plugin) to support :

        1) Deployment / undeployment of features,
        2) Generate html page about features : see http://fusesource.com/forums/message.jspa?messageID=2005#2005 for the suggestion
        3) Creation a few archetypes:

          - one for creating a custom smx kernel distribution + a set of
        features (like what we do for our distributions).
          - one for creating a feature descriptor automatically generated
        using the maven plugin we already have + upload in the maven repo. Ideally, the descriptor should be created from the user pom.xml profile file or (pom.xml files if the user has created a parent pom.xml with modules)
          - one for creating a manually written feature descriptor + upload in
        the maven repo

        The two last archetypes should reference our maven plugin so that they
        could be easily installed / uninstalled to a running (or not) smx4
        kernel instance using maven.

        Remark : this ticket has been created following discussions exchanged in the forum of SMX : http://www.nabble.com/forum/ViewPost.jtp?post=22285345&framed=y
        Edell Nolan made changes -
        Assignee Edell Nolan [ edelln ]
        Edell Nolan made changes -
        Status Open [ 1 ] In Progress [ 3 ]
        Hide
        Edell Nolan added a comment -

        I have been working on creating an archetype to generate a feature descriptor automatically if you add in dependencies into a pom.xml file - our maven features plugin does this already and I have the archetype working. But I have a question around having multiple pom.xml files in that you have a root pom and serveral modules. if you then attempt to run this from the root - I get the impression you are looking for a features.xml file that would have covered all the module poms.xml files. so that it will add the features for all dependencies in all the sub modules

        Is this the case ? or should it be that you just generate the features.xml for each module individually ?

        Show
        Edell Nolan added a comment - I have been working on creating an archetype to generate a feature descriptor automatically if you add in dependencies into a pom.xml file - our maven features plugin does this already and I have the archetype working. But I have a question around having multiple pom.xml files in that you have a root pom and serveral modules. if you then attempt to run this from the root - I get the impression you are looking for a features.xml file that would have covered all the module poms.xml files. so that it will add the features for all dependencies in all the sub modules Is this the case ? or should it be that you just generate the features.xml for each module individually ?
        Hide
        Charles Moulliard added a comment -

        Personally, I prefer to have one feature file generated when we have a parent pom with several slave pom (= modules).

        Show
        Charles Moulliard added a comment - Personally, I prefer to have one feature file generated when we have a parent pom with several slave pom (= modules).
        Hide
        Guillaume Nodet added a comment -

        I'm not sure that this is a good idea to generate the features file from the parent pom in case you have modules that are not really part of the feature, like an assembly of something like that.

        Show
        Guillaume Nodet added a comment - I'm not sure that this is a good idea to generate the features file from the parent pom in case you have modules that are not really part of the feature, like an assembly of something like that.
        Hide
        Edell Nolan added a comment -

        I was thinking about this a little more and I think it should just be based on one feature.xml file per pom.xml with its dependencies.
        You can always have one directory that will list all your dependencies and use this to create your features.xml file.

        I will get this in today hopefully.

        Show
        Edell Nolan added a comment - I was thinking about this a little more and I think it should just be based on one feature.xml file per pom.xml with its dependencies. You can always have one directory that will list all your dependencies and use this to create your features.xml file. I will get this in today hopefully.
        Hide
        Charles Moulliard added a comment -

        Most of the time, when you work on a OSGI project, you will create in eclipse several eclipse projects, one by bundle. So, it makes sense to create a parent pom pointing to the different modules / bundles and to have one global features file.

        Here is an example of what I do manually to deploy all my bundles :

        <features>
        <feature name="reportincident" version="1.0">
        <feature>camel-core</feature>
        <feature>camel-spring</feature>
        <feature>camel-osgi</feature>
        <feature>camel-bindy</feature>
        <feature>server</feature>
        <bundle>mvn:org.apache.camel.example/reportincident.domain/1.0-SNAPSHOT</bundle>
        <bundle>mvn:org.apache.camel.example/reportincident.service/1.0-SNAPSHOT</bundle>
        <bundle>mvn:org.apache.camel.example/reportincident.interfaces/1.0-SNAPSHOT</bundle>
        </feature>

        reportincident.domain = maven project = bundle = eclipse project

        Show
        Charles Moulliard added a comment - Most of the time, when you work on a OSGI project, you will create in eclipse several eclipse projects, one by bundle. So, it makes sense to create a parent pom pointing to the different modules / bundles and to have one global features file. Here is an example of what I do manually to deploy all my bundles : <features> <feature name="reportincident" version="1.0"> <feature>camel-core</feature> <feature>camel-spring</feature> <feature>camel-osgi</feature> <feature>camel-bindy</feature> <feature>server</feature> <bundle>mvn:org.apache.camel.example/reportincident.domain/1.0-SNAPSHOT</bundle> <bundle>mvn:org.apache.camel.example/reportincident.service/1.0-SNAPSHOT</bundle> <bundle>mvn:org.apache.camel.example/reportincident.interfaces/1.0-SNAPSHOT</bundle> </feature> reportincident.domain = maven project = bundle = eclipse project
        Hide
        Edell Nolan added a comment -

        Ok The way this currently works is that you would have one pom that would list dependencies on

        camel-core, camel-spring etc so this will generate your features.xml file - Also if you wish - it will indicate what other bundles it requires for classes that you may have not depended on and you can supply this list in a properties file so it will include dependent bundles for you as well.

        I will do up an example: that we did for our distribution of camel in servicemix.

        Show
        Edell Nolan added a comment - Ok The way this currently works is that you would have one pom that would list dependencies on camel-core, camel-spring etc so this will generate your features.xml file - Also if you wish - it will indicate what other bundles it requires for classes that you may have not depended on and you can supply this list in a properties file so it will include dependent bundles for you as well. I will do up an example: that we did for our distribution of camel in servicemix.
        Hide
        Edell Nolan added a comment -

        Attaching a patch - you will need the latest of the features maven plugin or change the version in the generated pom
        It depends on

        <features.maven.plugin.version>1.1-SNAPSHOT</features.maven.plugin.version>
        <servicemix.kernel.version>1.1.0-SNAPSHOT</servicemix.kernel.version>

        Example here : if you run

        Step1 :
        C:\edell-features>mvn archetype:create -DarchetypeGroupId=org.apache.servicemix.tooling -DarchetypeArtifactId=servicemix-features-descriptor -DgroupId=org.apache.servicemix.edell -DartifactId=org.apache.servicemix.testCamel.features -DarchetypeVersion=2008.01-SNAPSHOT -DremoteRepositories=REPO_LOCATION

        This will generate the following directory structure

        org.apache.servicemix.testCamel.features
        -> pom.xml
        -> src/main/resources/bundle.properties

        If you run mvn install => this will result in a features.xml file with nothing in it.

        <?xml version="1.0" encoding="UTF-8"?>
        <features>
        </features>

        Step 2:
        Your next step is to add your dependencies into the pom.xml file
        so if I added

        <dependencies>
        <dependency>
        <groupId>org.apache.camel</groupId>
        <artifactId>camel-core</artifactId>
        <version>1.5.0</version>
        </dependency>
        </dependencies>

        This will result in target/classes/feature.xml file

        <?xml version="1.0" encoding="UTF-8"?>
        <features>
        <feature name='camel-core'>
        <bundle>mvn:org.apache.camel/camel-core/1.5.0</bundle>
        </feature>
        </features>

        But it will also hint in the output about dependant bundles

        eg.
        [WARNING] Unable to find suitable bundle for dependency javax.activation (0.0.
        0) (required by camel-core)
        [WARNING] Unable to find suitable bundle for dependency javax.xml.bind (0.0.0)
        (required by camel-core)
        [WARNING] Unable to find suitable bundle for dependency javax.xml.bind.annotat
        ion (0.0.0) (required by camel-core)

        Step 3:

        You can add the dependant bundles to your bundle.properties file

        So you get a resulting feature.xml file

        <?xml version="1.0" encoding="UTF-8"?>
        <features>
        <feature name='camel-core'>
        <bundle>mvn:org.apache.servicemix.specs/org.apache.servicemix.specs.jaxb-api-2.1/1.2.0</bundle>
        <bundle>mvn:org.apache.servicemix.specs/org.apache.servicemix.specs.activation-api-1.1/1.2.0</bundle>
        <bundle>mvn:org.apache.camel/camel-core/1.5.0</bundle>
        </feature>
        </features>

        Show
        Edell Nolan added a comment - Attaching a patch - you will need the latest of the features maven plugin or change the version in the generated pom It depends on <features.maven.plugin.version>1.1-SNAPSHOT</features.maven.plugin.version> <servicemix.kernel.version>1.1.0-SNAPSHOT</servicemix.kernel.version> Example here : if you run Step1 : C:\edell-features>mvn archetype:create -DarchetypeGroupId=org.apache.servicemix.tooling -DarchetypeArtifactId=servicemix-features-descriptor -DgroupId=org.apache.servicemix.edell -DartifactId=org.apache.servicemix.testCamel.features -DarchetypeVersion=2008.01-SNAPSHOT -DremoteRepositories=REPO_LOCATION This will generate the following directory structure org.apache.servicemix.testCamel.features -> pom.xml -> src/main/resources/bundle.properties If you run mvn install => this will result in a features.xml file with nothing in it. <?xml version="1.0" encoding="UTF-8"?> <features> </features> Step 2: Your next step is to add your dependencies into the pom.xml file so if I added <dependencies> <dependency> <groupId>org.apache.camel</groupId> <artifactId>camel-core</artifactId> <version>1.5.0</version> </dependency> </dependencies> This will result in target/classes/feature.xml file <?xml version="1.0" encoding="UTF-8"?> <features> <feature name='camel-core'> <bundle>mvn:org.apache.camel/camel-core/1.5.0</bundle> </feature> </features> But it will also hint in the output about dependant bundles eg. [WARNING] Unable to find suitable bundle for dependency javax.activation (0.0. 0) (required by camel-core) [WARNING] Unable to find suitable bundle for dependency javax.xml.bind (0.0.0) (required by camel-core) [WARNING] Unable to find suitable bundle for dependency javax.xml.bind.annotat ion (0.0.0) (required by camel-core) Step 3: You can add the dependant bundles to your bundle.properties file So you get a resulting feature.xml file <?xml version="1.0" encoding="UTF-8"?> <features> <feature name='camel-core'> <bundle>mvn:org.apache.servicemix.specs/org.apache.servicemix.specs.jaxb-api-2.1/1.2.0</bundle> <bundle>mvn:org.apache.servicemix.specs/org.apache.servicemix.specs.activation-api-1.1/1.2.0</bundle> <bundle>mvn:org.apache.camel/camel-core/1.5.0</bundle> </feature> </features>
        Edell Nolan made changes -
        Attachment SMXKNL-217-feature.patch [ 17717 ]
        Hide
        Edell Nolan added a comment -

        You need to apply the patch to the servicemix-archetypes project.

        Show
        Edell Nolan added a comment - You need to apply the patch to the servicemix-archetypes project.
        Hide
        Charles Moulliard added a comment -

        Many thanks. I will try to have a look this afternoon or tomorrow.

        Show
        Charles Moulliard added a comment - Many thanks. I will try to have a look this afternoon or tomorrow.
        Hide
        Edell Nolan added a comment -

        I am going to create sub-tasks for each of the above archetypes etc

        Show
        Edell Nolan added a comment - I am going to create sub-tasks for each of the above archetypes etc
        Hide
        Charles Moulliard added a comment -

        Question : Do you filter the dependencies when generating the feature.xml to allow add the dependencies with scope = runtime ? It makes no sense to put in the feature file dependency only used for testing, by plugin and only compilation ?

        Show
        Charles Moulliard added a comment - Question : Do you filter the dependencies when generating the feature.xml to allow add the dependencies with scope = runtime ? It makes no sense to put in the feature file dependency only used for testing, by plugin and only compilation ?
        Hide
        Charles Moulliard added a comment -

        Hi Edell,

        How can I test on my PC the patch ?

        Show
        Charles Moulliard added a comment - Hi Edell, How can I test on my PC the patch ?
        Hide
        Edell Nolan added a comment -

        Hi,

        You need to apply this patch to the latest of Servicemix archetypes => https://svn.apache.org/repos/asf/servicemix/archetypes/trunk

        You may also need to do an update to the plugins as I fixed one/two bugs for NPE in the features plugin.

        Then attempt to create an archetype like I have described above - this patch curently only goes as far as generating your features.xml file.

        For the uploading - which is really installing everything in the features.xml - I am currently working on this part.

        Does this help ?

        Edell.

        Show
        Edell Nolan added a comment - Hi, You need to apply this patch to the latest of Servicemix archetypes => https://svn.apache.org/repos/asf/servicemix/archetypes/trunk You may also need to do an update to the plugins as I fixed one/two bugs for NPE in the features plugin. Then attempt to create an archetype like I have described above - this patch curently only goes as far as generating your features.xml file. For the uploading - which is really installing everything in the features.xml - I am currently working on this part. Does this help ? Edell.
        Hide
        Charles Moulliard added a comment - - edited

        I hope. I thought that the patch should be applied here : http://svn.apache.org/repos/asf/servicemix/maven-plugins/features-maven-plugin. I will add it to where you propose and test.

        Can you answer to my previous question : Do you filter dependencies .... ?

        Show
        Charles Moulliard added a comment - - edited I hope. I thought that the patch should be applied here : http://svn.apache.org/repos/asf/servicemix/maven-plugins/features-maven-plugin . I will add it to where you propose and test. Can you answer to my previous question : Do you filter dependencies .... ?
        Charles Moulliard made changes -
        Comment [ Hi Edell,

        I remark that the name of the artifactId of the pom created is not added in the tag <feature name="artifactId name must come here"> ]
        Hide
        Edell Nolan added a comment -

        Hi,

        No it doesn't appear to scope=runtime - I will look into this.

        Edell.

        Show
        Edell Nolan added a comment - Hi, No it doesn't appear to scope=runtime - I will look into this. Edell.
        Hide
        Charles Moulliard added a comment -

        Edell,

        The level of the packaging of the pom.xml created is pom. Is it correct or should it be bundle ?
        By the way, it should be interesting to add directly the maven-felix plugin in the pom because the code generated will be deployed as a bundle in SMX

        Show
        Charles Moulliard added a comment - Edell, The level of the packaging of the pom.xml created is pom. Is it correct or should it be bundle ? By the way, it should be interesting to add directly the maven-felix plugin in the pom because the code generated will be deployed as a bundle in SMX
        Hide
        Charles Moulliard added a comment -

        Edell,

        It should be interesting that the plugin works also with pom where <module> are defined.

        This could be very helpful because the feature file generated could be the sum of the features file created for each pom sub-project. Therefore, we have only one file to use to deploy our application containing different bundles (dao, domain, services, web, ...

        Name of the project : ReportIncident (= parent pom)
        module : dao
        module : domain
        module : service

        For each module, we have a feature file.

        When we launch mvn install (parent pom), the report incident feature file is generated and contains :

        <features
        <feature name='dao'/>
        <feature name='domain'/>
        <feature name='service'/>

        <feature name='dao version='A.0-SNAPSHOT'>
        <bundle>mvn:org.apache.camel.example/reportincident.dao/1.0-SNAPSHOT</bundle>
        <bundle>mvn:org.apache.camel/camel-core/1.6.0</bundle>
        <mvn: .....>
        </feature>

        ...

        </features>

        Show
        Charles Moulliard added a comment - Edell, It should be interesting that the plugin works also with pom where <module> are defined. This could be very helpful because the feature file generated could be the sum of the features file created for each pom sub-project. Therefore, we have only one file to use to deploy our application containing different bundles (dao, domain, services, web, ... Name of the project : ReportIncident (= parent pom) module : dao module : domain module : service For each module, we have a feature file. When we launch mvn install (parent pom), the report incident feature file is generated and contains : <features <feature name='dao'/> <feature name='domain'/> <feature name='service'/> <feature name='dao version='A.0-SNAPSHOT'> <bundle>mvn:org.apache.camel.example/reportincident.dao/1.0-SNAPSHOT</bundle> <bundle>mvn:org.apache.camel/camel-core/1.6.0</bundle> <mvn: .....> </feature> ... </features>
        Jeff Turner made changes -
        Project Import Sat Nov 27 02:09:01 EST 2010 [ 1290841741855 ]

          People

          • Assignee:
            Edell Nolan
            Reporter:
            Charles Moulliard
          • Votes:
            2 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:

              Development