Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [tycho-user] Generating component declarations

Hi Andres,

On Wed, May 28, 2014 at 12:18 AM, Andres Olarte <olarte.andres@xxxxxxxxx> wrote:
> (Sorry for my last email, I fat fingered the send button).
>
> Hi all,
>
> I'm looking for some util to help me generate the component declaration
> files for my OSGi services, and that plays nice with Tycho.
> I'm looking at something similar to the Felix SCR Plugin.  I could use that
> one, but it would require a lot of extra libraries just to be able to use
> some annotations. Are there other alternatives?

I started looking into this some time ago, but did not manage to get
to the end of it. See also this post [1] . Here's what I did ( from an
out-of-date patch for my project )

1. changed the MANIFEST.MF to import the osgi DS annotations and to
look for service-components

Optional resolution is to support older eclipse versions which don't
have the annotations available at runtime ; they're compile-time only
anyway.

+Service-Component: OSGI-INF/*.xml
+Import-Package: org.osgi.service.component.annotations;resolution:=optional

2. Changed to pom.xml to use the maven-scr-plugin and configure it to
write the SCR descriptors in the project root

The reason for writing those in the project root is that I was unable
to convince eclipse to pick them up otherwise when launching
applications from the workspace ( Run as -> Eclipse Application )

+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-scr-plugin</artifactId>
+                <version>1.13.0</version>
+                <configuration>
+                    <supportedProjectTypes>
+
<supportedProjectType>eclipse-plugin</supportedProjectType>
+                    </supportedProjectTypes>
+                    <outputDirectory>${basedir}</outputDirectory>
+                </configuration>
+                <dependencies>
+                    <dependency>
+                        <groupId>org.apache.felix</groupId>
+
<artifactId>org.apache.felix.scr.ds-annotations</artifactId>
+                        <version>1.2.2</version>
+                    </dependency>
+                    <dependency>
+                        <groupId>org.osgi</groupId>
+                        <artifactId>org.osgi.compendium</artifactId>
+                        <version>4.3.0</version>
+                    </dependency>
+                </dependencies>
+                <executions>
+                    <execution>
+                        <id>generate-scr-descriptor</id>
+                        <goals>
+                            <goal>scr</goal>
+                        </goals>
+                        <phase>compile</phase>
+                    </execution>
+                </executions>
+            </plugin>

Hopefully this helps you, and if you manage to get the build working,
please let us know .

Cheers,

Robert

[1]: http://dev.eclipse.org/mhonarc/lists/tycho-user/msg04764.html

>
> Thanks,
>
> Andres
>
>
> On Tue, May 27, 2014 at 5:15 PM, Andres Olarte <olarte.andres@xxxxxxxxx>
> wrote:
>>
>> Hi all,
>>
>> I'm looking at something similar to the Felix S
>>
>
>
> _______________________________________________
> tycho-user mailing list
> tycho-user@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/tycho-user
>



-- 
http://robert.muntea.nu/


Back to the top