You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@felix.apache.org by "Guillaume Nodet (JIRA)" <ji...@apache.org> on 2009/04/28 19:21:30 UTC

[jira] Commented: (FELIX-1083) Create new archetype to automatically generate feature.xml file + upload to the maven repo using features-maven-plugin

    [ https://issues.apache.org/jira/browse/FELIX-1083?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12703753#action_12703753 ] 

Guillaume Nodet commented on FELIX-1083:
----------------------------------------

Charles Moulliard - 02/Mar/09 02:41 AM
add reference to the forum link from which the ideas come
[ Show » ]
Charles Moulliard - 02/Mar/09 02:41 AM add reference to the forum link from which the ideas come

[ Permlink | Edit | Delete | « Hide ]
Edell Nolan - 03/Mar/09 10:17 AM
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 - 03/Mar/09 10:17 AM 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 ?

[ Permlink | Delete | « Hide ]
Charles Moulliard - 04/Mar/09 12:33 AM
Personally, I prefer to have one feature file generated when we have a parent pom with several slave pom (= modules).
[ Show » ]
Charles Moulliard - 04/Mar/09 12:33 AM Personally, I prefer to have one feature file generated when we have a parent pom with several slave pom (= modules).

[ Permlink | Delete | « Hide ]
Guillaume Nodet - 04/Mar/09 01:19 AM
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 - 04/Mar/09 01:19 AM 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.

[ Permlink | Edit | Delete | « Hide ]
Edell Nolan - 04/Mar/09 01:30 AM
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 - 04/Mar/09 01:30 AM 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.

[ Permlink | Delete | « Hide ]
Charles Moulliard - 04/Mar/09 01:31 AM
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 - 04/Mar/09 01:31 AM 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

[ Permlink | Edit | Delete | « Hide ]
Edell Nolan - 04/Mar/09 01:42 AM
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 - 04/Mar/09 01:42 AM 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.

[ Permlink | Edit | Delete | « Hide ]
Edell Nolan - 04/Mar/09 02:39 AM
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 - 04/Mar/09 02:39 AM 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>

[ Permlink | Edit | Delete | « Hide ]
Edell Nolan - 04/Mar/09 02:40 AM
You need to apply the patch to the servicemix-archetypes project.
[ Show » ]
Edell Nolan - 04/Mar/09 02:40 AM You need to apply the patch to the servicemix-archetypes project.

[ Permlink | Delete | « Hide ]
Charles Moulliard - 04/Mar/09 02:46 AM
Many thanks. I will try to have a look this afternoon or tomorrow.
[ Show » ]
Edell Nolan added a comment - 04/Mar/09 03:03 AM Charles Moulliard - 02/Mar/09 02:41 AM add reference to the forum link from which the ideas come [ Show » ] Charles Moulliard - 02/Mar/09 02:41 AM add reference to the forum link from which the ideas come [ Permlink | Edit | Delete | « Hide ] Edell Nolan - 03/Mar/09 10:17 AM 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 - 03/Mar/09 10:17 AM 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 ? [ Permlink | Delete | « Hide ] Charles Moulliard - 04/Mar/09 12:33 AM Personally, I prefer to have one feature file generated when we have a parent pom with several slave pom (= modules). [ Show » ] Charles Moulliard - 04/Mar/09 12:33 AM Personally, I prefer to have one feature file generated when we have a parent pom with several slave pom (= modules). [ Permlink | Delete | « Hide ] Guillaume Nodet - 04/Mar/09 01:19 AM 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 - 04/Mar/09 01:19 AM 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. [ Permlink | Edit | Delete | « Hide ] Edell Nolan - 04/Mar/09 01:30 AM 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 - 04/Mar/09 01:30 AM 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. [ Permlink | Delete | « Hide ] Charles Moulliard - 04/Mar/09 01:31 AM 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 - 04/Mar/09 01:31 AM 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 [ Permlink | Edit | Delete | « Hide ] Edell Nolan - 04/Mar/09 01:42 AM 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 - 04/Mar/09 01:42 AM 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. [ Permlink | Edit | Delete | « Hide ] Edell Nolan - 04/Mar/09 02:39 AM 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 - 04/Mar/09 02:39 AM 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> [ Permlink | Edit | Delete | « Hide ] Edell Nolan - 04/Mar/09 02:40 AM You need to apply the patch to the servicemix-archetypes project. [ Show » ] Edell Nolan - 04/Mar/09 02:40 AM You need to apply the patch to the servicemix-archetypes project. [ Permlink | Delete | « Hide ] Charles Moulliard - 04/Mar/09 02:46 AM Many thanks. I will try to have a look this afternoon or tomorrow.


> Create new archetype to automatically generate feature.xml file + upload to the maven repo using features-maven-plugin
> ----------------------------------------------------------------------------------------------------------------------
>
>                 Key: FELIX-1083
>                 URL: https://issues.apache.org/jira/browse/FELIX-1083
>             Project: Felix
>          Issue Type: Sub-task
>            Reporter: Guillaume Nodet
>
> Archetype 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)
> See comments in https://issues.apache.org/activemq/browse/SMX4KNL-217

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.