It's a 2 or 3 stage approach:

1. Use a traditional jar project with bnd-maven-plugin or bundle-maven-plugin 
to either build your source code as an OSGI jar or to take a non-OSGI 
dependency from a Maven repo and generate an OSGI version of it. Publish with 
standard 'mvn deploy' to Maven repo. This is the 'build01' part from the page 
you linked. The example uses the Apache Felix bundle-maven-plugin but my 
personal preference is the bnd-maven-plugin since it's from the same people who 
provide the underlying bnd tool that's generating the MANIFEST.

2. Use an eclipse-repository packaging type project with pom-first dependencies 
and the pomDependencies == consider mode to package and a P2 software site of 
all the dependencies you wrapped and published in #1.

3. Build your plugins/features/software sites with only eclipse-* packaging and 
MANIFEST-first dependencies, using the P2 site published in #2. This is the 
'build02' part of the page you linked.

The #2 stage is optional and can be replaced by putting <dependencies> in the 
pom.xml of your eclipse-* packaging type projects, duplicating them in MANIFEST 
(or feature.xml, or category.xml as appropriate per packaging type), and using 
pomDependencies == consider. This is where you really appreciate the limitation 
that these pom dependencies are not transitive. That is to say, if pluginA has 
pom dependency on lib1, and featureA includes pluginA, and repositoryA includes 
pluginA, then you need to have the pom dependency on lib1 in featureA and 
repositoryA. But you _don't_ put lib1 in featureA's feature.xml or 
repositoryA's category.xml if you don't want to package lib1 in your software 
site (like a provided scope pom dependency that should be installed already at 
runtime but you need it at compile time).

So including #2 makes life easier in #3 because you're then relying purely on 
Tycho's expected project setup, which incidentally is Eclipse compatible 
without involving m2e (after all the whole point of Tycho is to have a 
CLI/Maven build that works the same as Eclipse IDE for 
Plug-In/Feature/Product/Repository/Target projects).

-----Original Message-----
From: Karl Heinz Marbaise [mailto:khmarba...@gmx.de] 
Sent: Tuesday, March 21, 2017 5:06 PM
To: Justin Georgeson <jgeorge...@lgc.com>; Maven Users List 
<users@maven.apache.org>; i...@soebes.de
Subject: Re: [EXTERNAL] Re: Getting maven to create a bundle manifest 
incrementally in eclipse

External Sender: Use caution with links/attachments.



Hi,

as far as i know you can generate the MANIFEST file from that...?? Not 100%sure 
about this [1] cause I never used it myself..

Furthermore if you create an appropriate target platform and create a p2 repo 
from it (using tycho, upload to Nexus for example) this can be used to be 
integrated in your build in Eclipse (using tycho) which than will solve it also 
inside Eclipse...


Kind regards
Karl Heinz

[1]:
https://urldefense.proofpoint.com/v2/url?u=https-3A__wiki.eclipse.org_Tycho_How-5FTos_Dependency-5Fon-5Fpom-2Dfirst-5Fartifacts&d=DwICaQ&c=PskvixtEUDK7wuWU-tIg6oKuGYBRbrMXk2FZvF0UfTo&r=dLxYM3PBhAqFnkH7uKz_OVZL1uyui4QoEmBCjCmEiTk&m=Ht2mGcb7bKFhSYqPX9TkDkGR1_Ws4bXVOXQr6DHeYfc&s=RN498eCCq5qCVS9Wmn_z28u9DUGt85S5PSjKpU9qXxU&e=

On 21/03/17 22:42, Justin Georgeson wrote:
> POM-first dependencies in Tycho is just for resolution of plugin jars from 
> Maven repo (when they're not available in a P2 software site). It doesn't 
> handle writing your MANIFEST file to reflect those POM-first dependencies, so 
> you have to declare them in both files in that case.
>
> -----Original Message-----
> From: Karl Heinz Marbaise [mailto:khmarba...@gmx.de]
> Sent: Tuesday, March 21, 2017 3:34 PM
> To: Maven Users List <users@maven.apache.org>
> Subject: [EXTERNAL] Re: Getting maven to create a bundle manifest 
> incrementally in eclipse
>
> External Sender: Use caution with links/attachments.
>
>
>
> Hi Bill,
>
> On 21/03/17 16:01, Bill Mair wrote:
>> Hi,
>>
>> I'm attempting to switch to maven to create my packages but I have 
>> hit a snag that I can't find a solution for.
>>
>> Up until now, I have been controlling the dependencies of my ant 
>> build process with the contents of "META-INF/MANIFEST.MF". Maven 
>> works the other way around and generates that based on what I have 
>> actually used, which I think is fantastic.
>
> You can use Maven Tycho which gives you back the switch of requirement.
> In Tycho you can either work MANIFEST first or POM first setup...
>
> https://urldefense.proofpoint.com/v2/url?u=https-3A__eclipse.org_tycho
> _&d=DwICaQ&c=PskvixtEUDK7wuWU-tIg6oKuGYBRbrMXk2FZvF0UfTo&r=dLxYM3PBhAq
> FnkH7uKz_OVZL1uyui4QoEmBCjCmEiTk&m=Afq0-NWD7K5pqCrTDV4FppklgbeyRakFBIP
> qJoSP43Y&s=bGPk9-NRTEIkBgx-D3uOAMwB-b2itE0bf0pzjbKlZs0&e=
>
>
> And of course if your working on OSGi it makes sense to control the 
> dependencies via MANIFEST via Eclipse which can handle that very good 
> (dependencies, tree etc., target platforms etc.).
>
>
>
>>
>> I already have the git hash being included by 
>> buildnumber-maven-plugin (which required the additional 
>> pluginManagement section to work correctly in eclipse).
>
> Than you are using an old version cause 3.0.0 already includes this mapping 
> for m2e...
>
>
>>
>> My problem is that this is only generated when I build the bundle and 
>> not during incremental saves.
>
> The reason is simply cause you changed the side which means pom first..which 
> I would say is not a good idea in OSGi and Eclipse...
>
>
> Kind regards
> Karl Heinz Marbaise
>
>>
>> What do I have to change in this pom.xml to make eclipse, m2e, maven 
>> and the maven-bundle-plugin play nicely together?
>>
>> --
>> Bill Mair
>>
>> pom.xml
>> ------------
>> <project 
>> xmlns="https://urldefense.proofpoint.com/v2/url?u=http-3A__maven.apache.org_POM_4.0.0&d=DwICaQ&c=PskvixtEUDK7wuWU-tIg6oKuGYBRbrMXk2FZvF0UfTo&r=dLxYM3PBhAqFnkH7uKz_OVZL1uyui4QoEmBCjCmEiTk&m=Afq0-NWD7K5pqCrTDV4FppklgbeyRakFBIPqJoSP43Y&s=Kd-TDhLw1iVBaAqGOI6edW5kxuY1JW2ncBCQDTakR0Y&e=
>>  "
>> xmlns:xsi="https://urldefense.proofpoint.com/v2/url?u=http-3A__www.w3.org_2001_XMLSchema-2Dinstance&d=DwICaQ&c=PskvixtEUDK7wuWU-tIg6oKuGYBRbrMXk2FZvF0UfTo&r=dLxYM3PBhAqFnkH7uKz_OVZL1uyui4QoEmBCjCmEiTk&m=Afq0-NWD7K5pqCrTDV4FppklgbeyRakFBIPqJoSP43Y&s=UiQcEFOTpLzlDZ2bGKUP0roZmZ-lekq-ckzXz77Yxhk&e=
>>  "
>>
>> xsi:schemaLocation="https://urldefense.proofpoint.com/v2/url?u=http-3
>> A 
>> __maven.apache.org_POM_4.0.0&d=DwICaQ&c=PskvixtEUDK7wuWU-tIg6oKuGYBRb
>> r 
>> MXk2FZvF0UfTo&r=dLxYM3PBhAqFnkH7uKz_OVZL1uyui4QoEmBCjCmEiTk&m=Afq0-NW
>> D 
>> 7K5pqCrTDV4FppklgbeyRakFBIPqJoSP43Y&s=Kd-TDhLw1iVBaAqGOI6edW5kxuY1JW2
>> n
>> cBCQDTakR0Y&e=
>> https://urldefense.proofpoint.com/v2/url?u=http-3A__maven.apache.org_
>> x 
>> sd_maven-2D4.0.0.xsd&d=DwICaQ&c=PskvixtEUDK7wuWU-tIg6oKuGYBRbrMXk2FZv
>> F 
>> 0UfTo&r=dLxYM3PBhAqFnkH7uKz_OVZL1uyui4QoEmBCjCmEiTk&m=Afq0-NWD7K5pqCr
>> T 
>> DV4FppklgbeyRakFBIPqJoSP43Y&s=w_BXwgMpPrHERwc7gqdgadG__EXBDlY4TbMX5ia
>> p
>> Kqw&e= ">
>>
>>     <properties>
>>         
>> <https://urldefense.proofpoint.com/v2/url?u=http-3A__bundle.symbolicName&d=DwICaQ&c=PskvixtEUDK7wuWU-tIg6oKuGYBRbrMXk2FZvF0UfTo&r=dLxYM3PBhAqFnkH7uKz_OVZL1uyui4QoEmBCjCmEiTk&m=Afq0-NWD7K5pqCrTDV4FppklgbeyRakFBIPqJoSP43Y&s=TaSov7e93VtOFSW-wbSkimpcFZzq0fn2hX35RitVOPU&e=>test.iface</bundle.symbolicName>
>>         
>> <https://urldefense.proofpoint.com/v2/url?u=http-3A__bundle.namespace&d=DwICaQ&c=PskvixtEUDK7wuWU-tIg6oKuGYBRbrMXk2FZvF0UfTo&r=dLxYM3PBhAqFnkH7uKz_OVZL1uyui4QoEmBCjCmEiTk&m=Afq0-NWD7K5pqCrTDV4FppklgbeyRakFBIPqJoSP43Y&s=HMZ22MdATe7QYvAwINbNz14S1EiFEDYPPTUuMKtgw5M&e=>test.iface</bundle.namespace>
>>         
>> <https://urldefense.proofpoint.com/v2/url?u=http-3A__project.build.so
>> urceEncoding&d=DwICaQ&c=PskvixtEUDK7wuWU-tIg6oKuGYBRbrMXk2FZvF0UfTo&r
>> =dLxYM3PBhAqFnkH7uKz_OVZL1uyui4QoEmBCjCmEiTk&m=Afq0-NWD7K5pqCrTDV4Fpp
>> klgbeyRakFBIPqJoSP43Y&s=vDUOZN2NLvmaNvEKU56117LjFqTzysiSg8ADE9Upe5s&e
>> =>UTF-8</project.build.sourceEncoding>
>>
>> <https://urldefense.proofpoint.com/v2/url?u=http-3A__maven.build.timestamp.format&d=DwICaQ&c=PskvixtEUDK7wuWU-tIg6oKuGYBRbrMXk2FZvF0UfTo&r=dLxYM3PBhAqFnkH7uKz_OVZL1uyui4QoEmBCjCmEiTk&m=Afq0-NWD7K5pqCrTDV4FppklgbeyRakFBIPqJoSP43Y&s=a67ve_TjcESh76Y_up2Fue47aDtDNGDjCI7HyHsuK84&e=>yyyy/MM/dd
>>  HH:mm:ss z</maven.build.timestamp.format>
>>     </properties>
>>
>>     <modelVersion>4.0.0</modelVersion>
>>     <groupId>test</groupId>
>>     <artifactId>test.iface</artifactId>
>>     <version>1.0.1</version>
>>
>>     <scm>
>>         <connection>scm:git:file://.</connection>
>>         <developerConnection>scm:git:file://.</developerConnection>
>>         <url>scm:git:file://.</url>
>>         <tag>HEAD</tag>
>>     </scm>
>>
>>     <dependencies>
>>         <!-- eclipse virgo - equinox OSGi version -->
>>          <dependency>
>>             <groupId>org.osgi</groupId>
>>             <artifactId>org.osgi.core</artifactId>
>>             <version>5.0.0</version>
>>             <scope>provided</scope>
>>             <optional>true</optional>
>>         </dependency>
>>         <dependency>
>>             <groupId>org.osgi</groupId>
>>             <artifactId>org.osgi.compendium</artifactId>
>>             <version>4.3.0</version>
>>             <scope>provided</scope>
>>             <optional>true</optional>
>>         </dependency>
>>         <dependency>
>>             <groupId>javax.jws</groupId>
>>             <artifactId>jsr181-api</artifactId>
>>             <version>1.0-MR1</version>
>>         </dependency>
>>         <dependency>
>>             <groupId>junit</groupId>
>>             <artifactId>junit</artifactId>
>>             <version>4.12</version>
>>             <scope>compile</scope>
>>             <optional>true</optional>
>>         </dependency>
>>     </dependencies>
>>
>>     <packaging>bundle</packaging>
>>
>>     <build>
>>         <plugins>
>>             <plugin>
>>                 <groupId>org.apache.felix</groupId>
>>                 <artifactId>maven-bundle-plugin</artifactId>
>>                 <version>3.0.1</version>
>>                 <extensions>true</extensions>
>>                 <configuration>
>>                     <manifestLocation>META-INF</manifestLocation>
>>                     <instructions>
>>
>> <Bundle-SymbolicName>${bundle.symbolicName}</Bundle-SymbolicName>
>>
>> <Bundle-Version>${project.version}</Bundle-Version>
>>
>> <Bundle-Vendor>${https://urldefense.proofpoint.com/v2/url?u=http-3A__project.organization.name&d=DwICaQ&c=PskvixtEUDK7wuWU-tIg6oKuGYBRbrMXk2FZvF0UfTo&r=dLxYM3PBhAqFnkH7uKz_OVZL1uyui4QoEmBCjCmEiTk&m=Afq0-NWD7K5pqCrTDV4FppklgbeyRakFBIPqJoSP43Y&s=87NhXgu2s6w58G9NSUsrhABywCDx4VlX3KNjjMyy5Y4&e=
>>  }</Bundle-Vendor>
>>                         <Bundle-Copyright>Copyright (C) 
>> ${https://urldefense.proofpoint.com/v2/url?u=http-3A__project.organiz
>> a 
>> tion.name&d=DwICaQ&c=PskvixtEUDK7wuWU-tIg6oKuGYBRbrMXk2FZvF0UfTo&r=dL
>> x 
>> YM3PBhAqFnkH7uKz_OVZL1uyui4QoEmBCjCmEiTk&m=Afq0-NWD7K5pqCrTDV4Fppklgb
>> e yRakFBIPqJoSP43Y&s=87NhXgu2s6w58G9NSUsrhABywCDx4VlX3KNjjMyy5Y4&e=
>> }</Bundle-Copyright>
>>
>>
>> <Implementation-Build-Time>${maven.build.timestamp}</Implementation-B
>> u
>> ild-Time>
>>
>> <Implementation-Build>${buildNumber}</Implementation-Build>
>>
>>                         <!-- assume public classes are in the top 
>> package, and private classes are under ".internal" -->
>>
>>
>> <Export-Package>!${bundle.namespace}.internal.*,${bundle.namespace}.*
>> ; version="${project.version}"</Export-Package>
>>
>>                         <!--
>>
>> <Private-Package>${bundle.namespace}.*</Private-Package>
>>
>> <Bundle-Activator>${bundle.namespace}.Activator</Bundle-Activator>
>>
>> <Private-Package>${bundle.namespace}.internal.*</Private-Package>
>>
>> <Bundle-Activator>${bundle.namespace}.internal.ExampleActivator</Bund
>> l
>> e-Activator>
>>
>> <Fragment-Host>https://urldefense.proofpoint.com/v2/url?u=http-3A__or
>> g 
>> .fragment.host&d=DwICaQ&c=PskvixtEUDK7wuWU-tIg6oKuGYBRbrMXk2FZvF0UfTo
>> & 
>> r=dLxYM3PBhAqFnkH7uKz_OVZL1uyui4QoEmBCjCmEiTk&m=Afq0-NWD7K5pqCrTDV4Fp
>> p 
>> klgbeyRakFBIPqJoSP43Y&s=oc5ia3gl4WdLyg6hvW8Q3cSNnFRcGWvBSH44Bt_Y-o4&e
>> = ;bundle-version="1.0.0"</Fragment-Host>
>>
>> <Service-Component>OSGI-INF/configuration.xml</Service-Component>
>>
>> <Service-Component>OSGI-INF/*.xml</Service-Component>
>>                         -->
>>                     </instructions>
>>                 </configuration>
>>             </plugin>
>>             <plugin>
>>                 <groupId>org.codehaus.mojo</groupId>
>>                 <artifactId>buildnumber-maven-plugin</artifactId>
>>                 <version>1.4</version>
>>                 <executions>
>>                     <execution>
>>                         <phase>validate</phase>
>>                         <goals>
>>                             <goal>create</goal>
>>                         </goals>
>>                     </execution>
>>                 </executions>
>>                 <configuration>
>>                     <doCheck>false</doCheck>
>>                     <doUpdate>false</doUpdate>
>>                 </configuration>
>>             </plugin>
>>               <plugin>
>>                 <groupId>org.apache.maven.plugins</groupId>
>>                 <artifactId>maven-javadoc-plugin</artifactId>
>>                 <version>2.10.4</version>
>>                 <executions>
>>                     <execution>
>>                         <id>attach-javadocs</id>
>>                         <goals>
>>                             <goal>jar</goal>
>>                         </goals>
>>                     </execution>
>>                 </executions>
>>             </plugin>
>>             <plugin>
>>                 <groupId>org.apache.maven.plugins</groupId>
>>                 <artifactId>maven-source-plugin</artifactId>
>>                 <version>3.0.1</version>
>>                 <executions>
>>                     <execution>
>>                         <id>attach-sources</id>
>>                         <goals>
>>                             <goal>jar</goal>
>>                         </goals>
>>                     </execution>
>>                 </executions>
>>             </plugin>
>>             <plugin>
>>                 <groupId>org.apache.maven.plugins</groupId>
>>                 <artifactId>maven-compiler-plugin</artifactId>
>>                 <version>3.6.1</version>
>>                 <configuration>
>>                     <source>1.7</source>
>>                     <target>1.7</target>
>>                 </configuration>
>>             </plugin>
>>             <plugin>
>>                 <artifactId>maven-dependency-plugin</artifactId>
>>                 <executions>
>>                     <execution>
>>                         <id>copy-dependencies</id>
>>                         <phase>package</phase>
>>                         <goals>
>>                             <goal>copy-dependencies</goal>
>>                         </goals>
>>                     </execution>
>>                 </executions>
>>             </plugin>
>>         </plugins>
>>
>>         <pluginManagement>
>>             <plugins>
>>                 <plugin>
>>                     <groupId>org.eclipse.m2e</groupId>
>>                     <artifactId>lifecycle-mapping</artifactId>
>>                     <version>1.0.0</version>
>>                     <configuration>
>>                         <lifecycleMappingMetadata>
>>                             <pluginExecutions>
>>                                 <pluginExecution>
>>                                     <pluginExecutionFilter>
>>
>> <groupId>org.codehaus.mojo</groupId>
>>
>> <artifactId>buildnumber-maven-plugin</artifactId>
>>                                         <versionRange>[1.0,)</versionRange>
>>                                         <goals>
>>                                             <goal>create</goal>
>>                                         </goals>
>>                                     </pluginExecutionFilter>
>>                                     <action>
>>                                         <execute>
>>
>> <runOnIncremental>true</runOnIncremental>
>>                                         </execute>
>>                                     </action>
>>                                 </pluginExecution>
>>                             </pluginExecutions>
>>                         </lifecycleMappingMetadata>
>>                     </configuration>
>>                 </plugin>
>>             </plugins>
>>         </pluginManagement>
>>     </build>
>> </project>

----------------------------------------------------------------------
This e-mail, including any attached files, may contain confidential and 
privileged information for the sole use of the intended recipient.  Any review, 
use, distribution, or disclosure by others is strictly prohibited.  If you are 
not the intended recipient (or authorized to receive information for the 
intended recipient), please contact the sender by reply e-mail and delete all 
copies of this message.

Reply via email to