You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@felix.apache.org by Roy Teeuwen <ro...@teeuwen.be> on 2016/12/04 12:12:20 UTC

Maven bundle plugin with OSGi DS annotations

Hey all,

Since switching to OSGi DS I have been using the maven-bundle-plugin, instead of the maven-scr-plugin, by adding the <_dsannotations>*</_dsannotations> and <_metatypeannotations>*</_metatypeannotations>.

What I noticed now is that, in contrary to the maven-scr-plugin, this does not generate the OSGI-INF folder in the target/classes folder. Only when looking in the JAR file it actually generates this. This has two downsides:

It is harded to see the actual scr component.xml's that are generated, seeing as I have to open the generated JAR file.
When running tests in IntelliJ, it does not find the OSGI-INF folder anymore that are needed for some unit tests that I run, seeing as IntelliJ uses the classes in the target folder and does not have m2e like Eclipse has.

Is there any way to fix it that it goes back to the old situation and actually put the OSGI-INF folder also in the target/classes folder instead of only inside the produces end JAR ?

Thanks!
Roy

Re: Maven bundle plugin with OSGi DS annotations

Posted by Roy Teeuwen <ro...@teeuwen.be>.
Hey JB,

It seems that by accident I found a way to do it by looking at the slingshot sample project at Apache Sling, thanks though! 
<plugin>
    <groupId>org.apache.felix</groupId>
    <artifactId>maven-bundle-plugin</artifactId>
    <extensions>true</extensions>
    <executions>
        <!-- Configure extra execution of 'manifest' in process-classes phase to make sure SCR metadata is generated before unit test runs -->
        <execution>
            <id>scr-metadata</id>
            <goals>
                <goal>manifest</goal>
            </goals>
            <configuration>
                <supportIncrementalBuild>true</supportIncrementalBuild>
            </configuration>
        </execution>
    </executions>
    <configuration>
        <!-- Export SCR metadata to classpath to have them available in unit tests -->
        <exportScr>true</exportScr>
    </configuration>
</plugin>
Greets,
Roy

> On 4 Dec 2016, at 14:44, Roy Teeuwen <ro...@teeuwen.be> wrote:
> 
> Hey JB,
> 
> My configuration is the following:
> 
> <plugin>
>     <groupId>org.apache.felix</groupId>
>     <artifactId>maven-bundle-plugin</artifactId>
>     <version>3.2.0</version>
>     <extensions>true</extensions>
>     <configuration>
>         <instructions>
>             <_dsannotations>*</_dsannotations>
>             <_metatypeannotations>*</_metatypeannotations>
>         </instructions>
>     </configuration>
> </plugin>
> Greetings,
> Roy
> 
>> On 4 Dec 2016, at 13:44, Jean-Baptiste Onofré <jb@nanthrax.net <ma...@nanthrax.net>> wrote:
>> 
>> Hi Roy,
>> 
>> which maven-bundle-plugin version are you using ?
>> 
>> Regards
>> JB
>> 
>> On 12/04/2016 01:12 PM, Roy Teeuwen wrote:
>>> Hey all,
>>> 
>>> Since switching to OSGi DS I have been using the maven-bundle-plugin, instead of the maven-scr-plugin, by adding the <_dsannotations>*</_dsannotations> and <_metatypeannotations>*</_metatypeannotations>.
>>> 
>>> What I noticed now is that, in contrary to the maven-scr-plugin, this does not generate the OSGI-INF folder in the target/classes folder. Only when looking in the JAR file it actually generates this. This has two downsides:
>>> 
>>> It is harded to see the actual scr component.xml's that are generated, seeing as I have to open the generated JAR file.
>>> When running tests in IntelliJ, it does not find the OSGI-INF folder anymore that are needed for some unit tests that I run, seeing as IntelliJ uses the classes in the target folder and does not have m2e like Eclipse has.
>>> 
>>> Is there any way to fix it that it goes back to the old situation and actually put the OSGI-INF folder also in the target/classes folder instead of only inside the produces end JAR ?
>>> 
>>> Thanks!
>>> Roy
>>> 
>> 
>> -- 
>> Jean-Baptiste Onofré
>> jbonofre@apache.org <ma...@apache.org>
>> http://blog.nanthrax.net
>> Talend - http://www.talend.com
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>> For additional commands, e-mail: users-help@felix.apache.org
>> 
> 


Re: Maven bundle plugin with OSGi DS annotations

Posted by Roy Teeuwen <ro...@teeuwen.be>.
Hey JB,

My configuration is the following:

<plugin>
    <groupId>org.apache.felix</groupId>
    <artifactId>maven-bundle-plugin</artifactId>
    <version>3.2.0</version>
    <extensions>true</extensions>
    <configuration>
        <instructions>
            <_dsannotations>*</_dsannotations>
            <_metatypeannotations>*</_metatypeannotations>
        </instructions>
    </configuration>
</plugin>
Greetings,
Roy

> On 4 Dec 2016, at 13:44, Jean-Baptiste Onofré <jb...@nanthrax.net> wrote:
> 
> Hi Roy,
> 
> which maven-bundle-plugin version are you using ?
> 
> Regards
> JB
> 
> On 12/04/2016 01:12 PM, Roy Teeuwen wrote:
>> Hey all,
>> 
>> Since switching to OSGi DS I have been using the maven-bundle-plugin, instead of the maven-scr-plugin, by adding the <_dsannotations>*</_dsannotations> and <_metatypeannotations>*</_metatypeannotations>.
>> 
>> What I noticed now is that, in contrary to the maven-scr-plugin, this does not generate the OSGI-INF folder in the target/classes folder. Only when looking in the JAR file it actually generates this. This has two downsides:
>> 
>> It is harded to see the actual scr component.xml's that are generated, seeing as I have to open the generated JAR file.
>> When running tests in IntelliJ, it does not find the OSGI-INF folder anymore that are needed for some unit tests that I run, seeing as IntelliJ uses the classes in the target folder and does not have m2e like Eclipse has.
>> 
>> Is there any way to fix it that it goes back to the old situation and actually put the OSGI-INF folder also in the target/classes folder instead of only inside the produces end JAR ?
>> 
>> Thanks!
>> Roy
>> 
> 
> -- 
> Jean-Baptiste Onofré
> jbonofre@apache.org
> http://blog.nanthrax.net
> Talend - http://www.talend.com
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
> 


Re: Maven bundle plugin with OSGi DS annotations

Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
Hi Roy,

which maven-bundle-plugin version are you using ?

Regards
JB

On 12/04/2016 01:12 PM, Roy Teeuwen wrote:
> Hey all,
>
> Since switching to OSGi DS I have been using the maven-bundle-plugin, instead of the maven-scr-plugin, by adding the <_dsannotations>*</_dsannotations> and <_metatypeannotations>*</_metatypeannotations>.
>
> What I noticed now is that, in contrary to the maven-scr-plugin, this does not generate the OSGI-INF folder in the target/classes folder. Only when looking in the JAR file it actually generates this. This has two downsides:
>
> It is harded to see the actual scr component.xml's that are generated, seeing as I have to open the generated JAR file.
> When running tests in IntelliJ, it does not find the OSGI-INF folder anymore that are needed for some unit tests that I run, seeing as IntelliJ uses the classes in the target folder and does not have m2e like Eclipse has.
>
> Is there any way to fix it that it goes back to the old situation and actually put the OSGI-INF folder also in the target/classes folder instead of only inside the produces end JAR ?
>
> Thanks!
> Roy
>

-- 
Jean-Baptiste Onofr
jbonofre@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org