[ 
https://issues.apache.org/jira/browse/FELIX-846?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Clement Escoffier resolved FELIX-846.
-------------------------------------

    Resolution: Fixed

I provided a first way to support it in the revision 728951.
The issue comes from Maven/Plexus that provides a DOM mapping for XML 
configuration. However in this case, we don't want a DOM mapping as the 
elements are not known in advance (when using external handlers...).
Brett Porter 
(http://www.nabble.com/maven-plugin-with-an-XML-configuration-td20952804.html) 
describes how to turn around this issue with a CDATA block. That's the way I 
implemented it.

So iPOJO configuration can be in the pom file in the metadata element. The 
configuration is the same as the XML one (copy and paste) but must be in a 
CDATA block such as: 
<![CDATA[
        <ipojo 
                xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
                xsi:schemaLocation="org.apache.felix.ipojo 
http://felix.apache.org/ipojo/schemas/1.1.0-SNAPSHOT/core.xsd 
                org.apache.felix.ipojo.whiteboard 
http://felix.apache.org/ipojo/schemas/1.1.0-SNAPSHOT/whiteboard-pattern.xsd";
                xmlns="org.apache.felix.ipojo"
                xmlns:wbp="org.apache.felix.ipojo.whiteboard">
                <component classname="org.apache.felix.ipojo.test.FooProvider" 
name="fooprovider">
                        <provides>
                                <property field="foo" value="foo"/>
                        </provides>
                </component>
                <component 
classname="org.apache.felix.ipojo.test.FooWhiteBoardPattern" 
name="under-providers">
                                <wbp:wbp 
                                        
filter="(objectclass=org.apache.felix.ipojo.test.FooService)" 
                                        onArrival="onArrival" 
onDeparture="onDeparture" onModification="onModification"
                                />
                                <provides/>
                </component>
                <component 
classname="org.apache.felix.ipojo.test.FooWhiteBoardPattern" 
name="under-properties">
                                <wbp:wbp filter="(foo=foo)" 
onArrival="onArrival" onDeparture="onDeparture" 
                                        onModification="onModification"
                                />
                                <provides/>
                </component>
        </ipojo>
]]>

This solution is not the cleanest but at least works.

Here are some examples of pom file containing metadata:
Simple configuration : 
http://svn.apache.org/viewvc/felix/trunk/ipojo/arch/pom.xml?revision=728951&content-type=text%2Fplain&pathrev=728951
Configuration with XSD: 
http://svn.apache.org/viewvc/felix/trunk/ipojo/tests/core/lifecycle-controller/pom.xml?revision=728951&content-type=text%2Fplain&pathrev=728951
Configuration with XSD and external handlers: 
http://svn.apache.org/viewvc/felix/trunk/ipojo/tests/handler/whiteboard/pom.xml?revision=728951&content-type=text%2Fplain&pathrev=728951

> Enhance the iPojo maven plugin to take metadata from pom.
> ---------------------------------------------------------
>
>                 Key: FELIX-846
>                 URL: https://issues.apache.org/jira/browse/FELIX-846
>             Project: Felix
>          Issue Type: Improvement
>          Components: iPOJO
>    Affects Versions: iPOJO-1.0.0
>         Environment: Runtime: OSGi 4.1 + iPojo
> Build: Maven
>            Reporter: Todor Boev
>            Assignee: Clement Escoffier
>            Priority: Minor
>             Fix For: iPOJO-1.2.0
>
>         Attachments: pom.xml
>
>
> It would be nice if the iPojo Maven plugin could consume xml metadata 
> directly from my pom.xml rather than look for a separate metadata file. This 
> makes sense because the metadata.xml is used only at build time and does not 
> progress to become a resource bundle. So it's not realy a resource - it is 
> more part of the build scripts. And as such it's best if it can be integrated 
> into the ultimate build script - the pom.
> Also this will match the way metadata is specified to the BND maven plugin. 
> So we would have all data related to the construction of an iPojo bundle laid 
> out in the pom.

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

Reply via email to