In the meantime we’re using this as a workaround:

      <!-- src/main/feature/feature.xml -->
      <features>
        <feature name="${project.artifactId}">
          
<bundle>mvn:${project.groupId}/${project.artifactId}/${project.version}</bundle>
        </feature>
      </features>

along with this plugin execution:

      <plugin>
        <groupId>org.apache.karaf.tooling</groupId>
        <artifactId>karaf-maven-plugin</artifactId>
        <executions>
          <execution>
            <id>plugin-feature</id>
            <goals>
              <goal>features-generate-descriptor</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

This generates a feature that includes the bundle’s dependencies - it also 
merges in the snippet from src/main/feature/feature.xml which adds the bundle 
itself.

BTW, you don’t need to use the build-helper-maven-plugin to attach the feature 
because it’s automatically attached by the features-generate-descriptor goal.

On 23 Jul 2014, at 14:07, rsteppac <[email protected]> wrote:

> Excellent. I have up-voted the ticket.
> 
> Ralf
> 
> On 23.07.2014, at 14:45, Stuart McCulloch [via Karaf] 
> <[email protected]> wrote:
> 
>> It is possible with the proposed patch in 
>> https://issues.apache.org/jira/browse/KARAF-2961(the pull-request includes 
>> an example test project)
>> 
>> Maven supports additional attachments to a project by using classifiers - 
>> and since a karaf feature already uses a classifier there's no issue there 
>> either with it conflicting with the main artifact.
>> 
>> --
>> Cheers, Stuart
>> 
>> On 23 Jul 2014, at 13:28, Achim Nierbeck <[hidden email]> wrote:
>> 
>>> Nope, not possible, and not really a solution to long for. 
>>> As your bundle is a maven artifact while the feature file itself is also an 
>>> artifact. 
>>> In that case it also makes much more sense to have two separate maven 
>>> modules. 
>>> 
>>> Regards, Achim 
>>> 
>>> 
>>> 2014-07-23 14:23 GMT+02:00 rsteppac <[hidden email]>:
>>> I am trying to use the karaf-maven-plugin (v 3.0.1) to dynamically build the
>>> feature.xml required to deploy my bundle in Karaf. The only setup I got to
>>> work is to have a separate maven project that declares the bundle project as
>>> a dependency. Doing so will create a feature.xml that contains my bundle and
>>> all its dependencies.
>>> 
>>> I was hoping to be able to do away with the additional project by generating
>>> the feature.xml in the bundle project itself and then adding it as a
>>> resource to the installation/deployment phase like so:
>>> 
>>> <build>
>>>    <plugins>
>>>        <plugin>
>>>            <groupId>org.apache.karaf.tooling</groupId>
>>>            <artifactId>karaf-maven-plugin</artifactId>
>>>            <executions>
>>>                <execution>
>>>                    <id>generate-features-descriptor</id>
>>>                    <phase>generate-resources</phase>
>>>                    <goals>
>>>                        <goal>features-generate-descriptor</goal>
>>>                    </goals>
>>>                </execution>
>>>            </executions>
>>>        </plugin>
>>>        <plugin>
>>>            <groupId>org.codehaus.mojo</groupId>
>>>            <artifactId>build-helper-maven-plugin</artifactId>
>>>            <executions>
>>>                <execution>
>>>                    <id>attach-artifacts</id>
>>>                    <phase>package</phase>
>>>                    <goals>
>>>                        <goal>attach-artifact</goal>
>>>                    </goals>
>>>                    <configuration>
>>>                        <artifacts>
>>>                            <artifact>
>>>                                <file>target/feature/feature.xml</file>
>>>                                <type>xml</type>
>>>                                <classifier>features</classifier>
>>>                            </artifact>
>>>                        </artifacts>
>>>                    </configuration>
>>>                </execution>
>>>            </executions>
>>>        </plugin>
>>>    </plugins>
>>> </build>
>>> 
>>> I bound the "features-generate-descriptor" goal to different phases, but the
>>> resulting feature.xml always only contains the dependencies of my bundle,
>>> but not the bundle itself.
>>> How would I have to configure the plugin to create both artifacts,
>>> feature.xml and bundle jar, in the same project build?
>>> 
>>> 
>>> Thanks!
>>> Ralf
>>> 
>>> 
>>> 
>>> --
>>> View this message in context: 
>>> http://karaf.922171.n3.nabble.com/How-to-generate-bundle-jar-and-feature-xml-in-same-Maven-build-tp4034402.html
>>> Sent from the Karaf - User mailing list archive at Nabble.com.
>>> 
>>> 
>>> 
>>> -- 
>>> 
>>> Apache Member
>>> Apache Karaf <http://karaf.apache.org/> Committer & PMC
>>> OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/> Committer & 
>>> Project Lead
>>> blog <http://notizblog.nierbeck.de/>
>>> 
>>> Software Architect / Project Manager / Scrum Master
>>> 
>> 
>> 
>> If you reply to this email, your message will be added to the discussion 
>> below:
>> http://karaf.922171.n3.nabble.com/How-to-generate-bundle-jar-and-feature-xml-in-same-Maven-build-tp4034402p4034406.html
>> To unsubscribe from How to generate bundle jar and feature.xml in same Maven 
>> build, click here.
>> NAML
> 
> 
> 
> smime.p7s (5K) 
> <http://karaf.922171.n3.nabble.com/attachment/4034410/0/smime.p7s>
> 
> 
> 
> 
> --
> View this message in context: 
> http://karaf.922171.n3.nabble.com/How-to-generate-bundle-jar-and-feature-xml-in-same-Maven-build-tp4034402p4034410.html
> Sent from the Karaf - User mailing list archive at Nabble.com.

Reply via email to