You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@felix.apache.org by Cristiano Gavião <cv...@gmail.com> on 2016/06/01 20:25:13 UTC

[maven-bundle-plugin] v.3.0.x regression for DS xml generation ?

Hi,

I used to use m-b-p version 2.5.4 and the generation of the DS component 
xmls was working fine.

But after I moved to version 3.0.1 (also tried with 3.0.0) the xml 
generation simply stops to work. also inside eclipse (with m2e).

There are any error message in the building maven console or eclipse 
console, but the xmls are simply not there...

I moved back to 2.5.4 again and things back to normal....

I'm using the setup bellow:

                    <plugin>
    <groupId>org.apache.felix</groupId>
    <artifactId>maven-bundle-plugin</artifactId>
                         <version>${mbp.version}</version>
                         <extensions>true</extensions>
                         <configuration>
    <obrRepository>NONE</obrRepository>
                             <instructions>
    <Bundle-DocURL>${project.url}</Bundle-DocURL>
    <Bundle-Name>${project.name}</Bundle-Name>
    <Bundle-Version>${bundle.full.version}</Bundle-Version>
    <Bundle-ActivationPolicy>lazy</Bundle-ActivationPolicy>
    <_dsannotations>*</_dsannotations>
    <_metatypeannotations>*</_metatypeannotations>
    <Bundle-RequiredExecutionEnvironment>JavaSE-1.8</Bundle-RequiredExecutionEnvironment>
    <_snapshot>${osgi-version-qualifier}</_snapshot>
    <_versionpolicy>[$(version;==;$(@)),$(version;+;$(@)))</_versionpolicy>
                             </instructions>
                             <supportedProjectTypes>
    <supportedProjectType>bundle</supportedProjectType>
    <supportedProjectType>jar</supportedProjectType>
                             </supportedProjectTypes>
                         </configuration>
    <executions>
                                     <execution>
    <id>gen-bundle-manifest</id>
                                         <goals>
    <goal>manifest</goal>
                                         </goals>
    <phase>process-classes</phase>
                                         <configuration>

                                             <instructions>
    <Permissions>all-permissions</Permissions>
    <Include-Resource>{maven-dependencies},{maven-resources},META-INF/LICENSE=LICENSE.txt</Include-Resource>
    <_removeheaders>Include-Resource,Private-Package,Ignore-Package</_removeheaders>
                                             </instructions>
                                         </configuration>
                                     </execution>
                     </plugin>

anyone have experienced this issue ?

thanks,

Cristiano

Re: [maven-bundle-plugin] v.3.0.x regression for DS xml generation ?

Posted by Cristiano Gavião <cv...@gmail.com>.
what a day... :-(

I finally discovered what is need in order to the scr xmls to be write 
when using m-b-p "manifest" goal.

bndLib is doing its great work properly. The problem is that the 
"manifest" goal doesn't do what its parent "bundle" goal is doing and is 
not traversing the generated in-memory jar in order to write the scr files.

Interestingly I found an undocumented parameter named "*scrExport*" 
which seems it was created to do just what I was needing and also the 
metatype artifacts. but it seems to be buggy apparently because any xml 
was created when setting it to true.

So, what you need to do is to set *unpackBundle* parameter to true. This 
will make the plugin to traverse the in memory jar created by bndLib and 
save its contents to disk.



On 25/06/2016 11:43, Cristiano Gavi�o wrote:
> Hello again,
>
> I've passed a long time doing some debugging...  I've cloned the 
> latest felix git repository and I'm using the 3.1.0-SNAPSHOT.
> I think I found where the problem could be.
>
> In maven-bundle-plugin, the 
> org.apache.felix.bundleplugin.ManifestPlugin in line 287, sets the 
> Builder jar property as the /target/classes directory. But seems to me 
> that aQute.bnd.osgi.Jar is not handling directory properly anymore.
>
>             analyzer.setJar( file );
>
> The aQute.bnd.component.DSAnnotations class calls the 
> aQute.bnd.osgi.Jar object in order to write the generated xml:
>
>     analyzer.getJar().putResource(name, new
>     TagResource(definition.getTag()));
>
>  and it is where the things are not working anymore...
>
> I already have notified bndlib team in its google group about this. 
> I'm waiting some confirmation...
>
> Btw, the first time I tried to debug the plugin, I had an issue when 
> executing the part where bndlib process Prototype scope. This made the 
> debug tool get crazy and get out of the method when it tried to 
> execute this 6.0.0 related class:
>
>     if (comp.scope() ==/ServiceScope.PROTOTYPE/) {
>                     component.updateVersion(V1_3);
>                 }
>
> I noted that bndlib 3.2.0 requires osgi.core 6.0.0, but the m-b-plugin 
> is tied to version 4.3.1.
>
> I only was able to debug after set the proper osgi bundles in the 
> classpath.
>
> could some m-b-p committer give me a feedback, please?
>
> thanks
>
> On 01/06/2016 17:25, Cristiano Gavi�o wrote:
>> Hi,
>>
>> I used to use m-b-p version 2.5.4 and the generation of the DS 
>> component xmls was working fine.
>>
>> But after I moved to version 3.0.1 (also tried with 3.0.0) the xml 
>> generation simply stops to work. also inside eclipse (with m2e).
>>
>> There are any error message in the building maven console or eclipse 
>> console, but the xmls are simply not there...
>>
>> I moved back to 2.5.4 again and things back to normal....
>>
>> I'm using the setup bellow:
>>
>>                    <plugin>
>>     <groupId>org.apache.felix</groupId>
>>     <artifactId>maven-bundle-plugin</artifactId>
>>     <version>${mbp.version}</version>
>>                         <extensions>true</extensions>
>>                         <configuration>
>>     <obrRepository>NONE</obrRepository>
>>                             <instructions>
>>     <Bundle-DocURL>${project.url}</Bundle-DocURL>
>>     <Bundle-Name>${project.name}</Bundle-Name>
>>     <Bundle-Version>${bundle.full.version}</Bundle-Version>
>>     <Bundle-ActivationPolicy>lazy</Bundle-ActivationPolicy>
>>     <_dsannotations>*</_dsannotations>
>>     <_metatypeannotations>*</_metatypeannotations>
>>     <Bundle-RequiredExecutionEnvironment>JavaSE-1.8</Bundle-RequiredExecutionEnvironment>
>>     <_snapshot>${osgi-version-qualifier}</_snapshot>
>>     <_versionpolicy>[$(version;==;$(@)),$(version;+;$(@)))</_versionpolicy>
>>                             </instructions>
>>                             <supportedProjectTypes>
>>     <supportedProjectType>bundle</supportedProjectType>
>>     <supportedProjectType>jar</supportedProjectType>
>>                             </supportedProjectTypes>
>>                         </configuration>
>>     <executions>
>>                                     <execution>
>>     <id>gen-bundle-manifest</id>
>>                                         <goals>
>>     <goal>manifest</goal>
>>                                         </goals>
>>     <phase>process-classes</phase>
>>                                         <configuration>
>>
>>                                             <instructions>
>>     <Permissions>all-permissions</Permissions>
>>     <Include-Resource>{maven-dependencies},{maven-resources},META-INF/LICENSE=LICENSE.txt</Include-Resource>
>>     <_removeheaders>Include-Resource,Private-Package,Ignore-Package</_removeheaders>
>>                                             </instructions>
>>                                         </configuration>
>>                                     </execution>
>>                     </plugin>
>>
>> anyone have experienced this issue ?
>>
>> thanks,
>>
>> Cristiano
>


Re: [maven-bundle-plugin] v.3.0.x regression for DS xml generation ?

Posted by Cristiano Gavião <cv...@gmail.com>.
Hello again,

I've passed a long time doing some debugging...  I've cloned the latest 
felix git repository and I'm using the 3.1.0-SNAPSHOT.
I think I found where the problem could be.

In maven-bundle-plugin, the org.apache.felix.bundleplugin.ManifestPlugin 
in line 287, sets the Builder jar property as the /target/classes 
directory. But seems to me that aQute.bnd.osgi.Jar is not handling 
directory properly anymore.

             analyzer.setJar( file );

The aQute.bnd.component.DSAnnotations class calls the aQute.bnd.osgi.Jar 
object in order to write the generated xml:

    analyzer.getJar().putResource(name, new
    TagResource(definition.getTag()));

  and it is where the things are not working anymore...

I already have notified bndlib team in its google group about this. I'm 
waiting some confirmation...

Btw, the first time I tried to debug the plugin, I had an issue when 
executing the part where bndlib process Prototype scope.  This made the 
debug tool get crazy and get out of the method when it tried to execute 
this 6.0.0 related class:

    if (comp.scope() ==/ServiceScope.PROTOTYPE/) {
                     component.updateVersion(V1_3);
                 }

I noted that bndlib 3.2.0 requires osgi.core 6.0.0, but the m-b-plugin 
is tied to version 4.3.1.

I only was able to debug after set the proper osgi bundles in the classpath.

could some m-b-p committer give me a feedback, please?

thanks

On 01/06/2016 17:25, Cristiano Gavi�o wrote:
> Hi,
>
> I used to use m-b-p version 2.5.4 and the generation of the DS 
> component xmls was working fine.
>
> But after I moved to version 3.0.1 (also tried with 3.0.0) the xml 
> generation simply stops to work. also inside eclipse (with m2e).
>
> There are any error message in the building maven console or eclipse 
> console, but the xmls are simply not there...
>
> I moved back to 2.5.4 again and things back to normal....
>
> I'm using the setup bellow:
>
>                    <plugin>
>     <groupId>org.apache.felix</groupId>
>     <artifactId>maven-bundle-plugin</artifactId>
>     <version>${mbp.version}</version>
>                         <extensions>true</extensions>
>                         <configuration>
>     <obrRepository>NONE</obrRepository>
>                             <instructions>
>     <Bundle-DocURL>${project.url}</Bundle-DocURL>
>     <Bundle-Name>${project.name}</Bundle-Name>
>     <Bundle-Version>${bundle.full.version}</Bundle-Version>
>     <Bundle-ActivationPolicy>lazy</Bundle-ActivationPolicy>
>     <_dsannotations>*</_dsannotations>
>     <_metatypeannotations>*</_metatypeannotations>
>     <Bundle-RequiredExecutionEnvironment>JavaSE-1.8</Bundle-RequiredExecutionEnvironment>
>     <_snapshot>${osgi-version-qualifier}</_snapshot>
>     <_versionpolicy>[$(version;==;$(@)),$(version;+;$(@)))</_versionpolicy>
>                             </instructions>
>                             <supportedProjectTypes>
>     <supportedProjectType>bundle</supportedProjectType>
>     <supportedProjectType>jar</supportedProjectType>
>                             </supportedProjectTypes>
>                         </configuration>
>     <executions>
>                                     <execution>
>     <id>gen-bundle-manifest</id>
>                                         <goals>
>     <goal>manifest</goal>
>                                         </goals>
>     <phase>process-classes</phase>
>                                         <configuration>
>
>                                             <instructions>
>     <Permissions>all-permissions</Permissions>
>     <Include-Resource>{maven-dependencies},{maven-resources},META-INF/LICENSE=LICENSE.txt</Include-Resource>
>     <_removeheaders>Include-Resource,Private-Package,Ignore-Package</_removeheaders>
>                                             </instructions>
>                                         </configuration>
>                                     </execution>
>                     </plugin>
>
> anyone have experienced this issue ?
>
> thanks,
>
> Cristiano


Re: [maven-bundle-plugin] v.3.0.x regression for DS xml generation ?

Posted by Cristiano Gavião <cv...@gmail.com>.
Hi,

Well, I don't think it is related...

Also, the snapshot version of m-b-p that I'm debugging with is using the 
latest version of bndlib published [1].


[1] 
http://search.maven.org/#artifactdetails%7Cbiz.aQute.bnd%7Cbiz.aQute.bndlib%7C3.2.0%7Cjar

On 25/06/2016 12:22, Christian Schneider wrote:
> I also had problems with the maven-bundle-plugin recently when using
>
> @Reference
> volatile List<Myclass> myList;
>
> This should create a dynamic list but did not work in 
> maven-bundle-plugin. After asking on the bndtools user list I got the 
> response that
> it was a bug in an older version of bnd and that maven-bundle-plugin 
> still uses this old version.
>
> I was able to fix this by switching to the bnd-maven-plugin. So I 
> think the maven-bundle-plugin should be updated to this newest bnd 
> version.
>
> Maybe you are facing a similar problem.
>
> Christian
>
> On 01.06.2016 22:25, Cristiano Gavi�o wrote:
>> Hi,
>>
>> I used to use m-b-p version 2.5.4 and the generation of the DS 
>> component xmls was working fine.
>>
>> But after I moved to version 3.0.1 (also tried with 3.0.0) the xml 
>> generation simply stops to work. also inside eclipse (with m2e).
>>
>> There are any error message in the building maven console or eclipse 
>> console, but the xmls are simply not there...
>>
>> I moved back to 2.5.4 again and things back to normal....
>>
>> I'm using the setup bellow:
>>
>>                    <plugin>
>>    <groupId>org.apache.felix</groupId>
>>    <artifactId>maven-bundle-plugin</artifactId>
>> <version>${mbp.version}</version>
>> <extensions>true</extensions>
>>                         <configuration>
>>    <obrRepository>NONE</obrRepository>
>>                             <instructions>
>>    <Bundle-DocURL>${project.url}</Bundle-DocURL>
>>    <Bundle-Name>${project.name}</Bundle-Name>
>> <Bundle-Version>${bundle.full.version}</Bundle-Version>
>> <Bundle-ActivationPolicy>lazy</Bundle-ActivationPolicy>
>>    <_dsannotations>*</_dsannotations>
>>    <_metatypeannotations>*</_metatypeannotations>
>> <Bundle-RequiredExecutionEnvironment>JavaSE-1.8</Bundle-RequiredExecutionEnvironment> 
>>
>>    <_snapshot>${osgi-version-qualifier}</_snapshot>
>> <_versionpolicy>[$(version;==;$(@)),$(version;+;$(@)))</_versionpolicy>
>>                             </instructions>
>>                             <supportedProjectTypes>
>> <supportedProjectType>bundle</supportedProjectType>
>>    <supportedProjectType>jar</supportedProjectType>
>>                             </supportedProjectTypes>
>>                         </configuration>
>>    <executions>
>>                                     <execution>
>>    <id>gen-bundle-manifest</id>
>>                                         <goals>
>>    <goal>manifest</goal>
>>                                         </goals>
>>    <phase>process-classes</phase>
>>                                         <configuration>
>>
>>                                             <instructions>
>>    <Permissions>all-permissions</Permissions>
>> <Include-Resource>{maven-dependencies},{maven-resources},META-INF/LICENSE=LICENSE.txt</Include-Resource> 
>>
>> <_removeheaders>Include-Resource,Private-Package,Ignore-Package</_removeheaders> 
>>
>> </instructions>
>>                                         </configuration>
>>                                     </execution>
>>                     </plugin>
>>
>> anyone have experienced this issue ?
>>
>> thanks,
>>
>> Cristiano
>>
>
>


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


Re: [maven-bundle-plugin] v.3.0.x regression for DS xml generation ?

Posted by Neil Bartlett <nj...@gmail.com>.
FWIW… I don’t think that List field should be volatile. SCR doesn’t replace the whole List, it calls the add/remove methods. The list itself can (and probably should) be final.

Neil

> On 25 Jun 2016, at 16:22, Christian Schneider <ch...@die-schneider.net> wrote:
> 
> I also had problems with the maven-bundle-plugin recently when using
> 
> @Reference
> volatile List<Myclass> myList;
> 
> This should create a dynamic list but did not work in maven-bundle-plugin. After asking on the bndtools user list I got the response that
> it was a bug in an older version of bnd and that maven-bundle-plugin still uses this old version.
> 
> I was able to fix this by switching to the bnd-maven-plugin. So I think the maven-bundle-plugin should be updated to this newest bnd version.
> 
> Maybe you are facing a similar problem.
> 
> Christian
> 
> On 01.06.2016 22:25, Cristiano Gavião wrote:
>> Hi,
>> 
>> I used to use m-b-p version 2.5.4 and the generation of the DS component xmls was working fine.
>> 
>> But after I moved to version 3.0.1 (also tried with 3.0.0) the xml generation simply stops to work. also inside eclipse (with m2e).
>> 
>> There are any error message in the building maven console or eclipse console, but the xmls are simply not there...
>> 
>> I moved back to 2.5.4 again and things back to normal....
>> 
>> I'm using the setup bellow:
>> 
>>                   <plugin>
>>   <groupId>org.apache.felix</groupId>
>>   <artifactId>maven-bundle-plugin</artifactId>
>> <version>${mbp.version}</version>
>>                        <extensions>true</extensions>
>>                        <configuration>
>>   <obrRepository>NONE</obrRepository>
>>                            <instructions>
>>   <Bundle-DocURL>${project.url}</Bundle-DocURL>
>>   <Bundle-Name>${project.name}</Bundle-Name>
>> <Bundle-Version>${bundle.full.version}</Bundle-Version>
>> <Bundle-ActivationPolicy>lazy</Bundle-ActivationPolicy>
>>   <_dsannotations>*</_dsannotations>
>>   <_metatypeannotations>*</_metatypeannotations>
>> <Bundle-RequiredExecutionEnvironment>JavaSE-1.8</Bundle-RequiredExecutionEnvironment>
>>   <_snapshot>${osgi-version-qualifier}</_snapshot>
>> <_versionpolicy>[$(version;==;$(@)),$(version;+;$(@)))</_versionpolicy>
>>                            </instructions>
>>                            <supportedProjectTypes>
>>   <supportedProjectType>bundle</supportedProjectType>
>>   <supportedProjectType>jar</supportedProjectType>
>>                            </supportedProjectTypes>
>>                        </configuration>
>>   <executions>
>>                                    <execution>
>>   <id>gen-bundle-manifest</id>
>>                                        <goals>
>>   <goal>manifest</goal>
>>                                        </goals>
>>   <phase>process-classes</phase>
>>                                        <configuration>
>> 
>>                                            <instructions>
>>   <Permissions>all-permissions</Permissions>
>> <Include-Resource>{maven-dependencies},{maven-resources},META-INF/LICENSE=LICENSE.txt</Include-Resource>
>> <_removeheaders>Include-Resource,Private-Package,Ignore-Package</_removeheaders>
>>                                            </instructions>
>>                                        </configuration>
>>                                    </execution>
>>                    </plugin>
>> 
>> anyone have experienced this issue ?
>> 
>> thanks,
>> 
>> Cristiano
>> 
> 
> 
> -- 
> Christian Schneider
> http://www.liquid-reality.de
> 
> Open Source Architect
> http://www.talend.com
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
> 


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


Re: [maven-bundle-plugin] v.3.0.x regression for DS xml generation ?

Posted by Christian Schneider <ch...@die-schneider.net>.
I also had problems with the maven-bundle-plugin recently when using

@Reference
volatile List<Myclass> myList;

This should create a dynamic list but did not work in 
maven-bundle-plugin. After asking on the bndtools user list I got the 
response that
it was a bug in an older version of bnd and that maven-bundle-plugin 
still uses this old version.

I was able to fix this by switching to the bnd-maven-plugin. So I think 
the maven-bundle-plugin should be updated to this newest bnd version.

Maybe you are facing a similar problem.

Christian

On 01.06.2016 22:25, Cristiano Gavi�o wrote:
> Hi,
>
> I used to use m-b-p version 2.5.4 and the generation of the DS 
> component xmls was working fine.
>
> But after I moved to version 3.0.1 (also tried with 3.0.0) the xml 
> generation simply stops to work. also inside eclipse (with m2e).
>
> There are any error message in the building maven console or eclipse 
> console, but the xmls are simply not there...
>
> I moved back to 2.5.4 again and things back to normal....
>
> I'm using the setup bellow:
>
>                    <plugin>
>    <groupId>org.apache.felix</groupId>
>    <artifactId>maven-bundle-plugin</artifactId>
> <version>${mbp.version}</version>
>                         <extensions>true</extensions>
>                         <configuration>
>    <obrRepository>NONE</obrRepository>
>                             <instructions>
>    <Bundle-DocURL>${project.url}</Bundle-DocURL>
>    <Bundle-Name>${project.name}</Bundle-Name>
> <Bundle-Version>${bundle.full.version}</Bundle-Version>
> <Bundle-ActivationPolicy>lazy</Bundle-ActivationPolicy>
>    <_dsannotations>*</_dsannotations>
>    <_metatypeannotations>*</_metatypeannotations>
> <Bundle-RequiredExecutionEnvironment>JavaSE-1.8</Bundle-RequiredExecutionEnvironment>
>    <_snapshot>${osgi-version-qualifier}</_snapshot>
> <_versionpolicy>[$(version;==;$(@)),$(version;+;$(@)))</_versionpolicy>
>                             </instructions>
>                             <supportedProjectTypes>
>    <supportedProjectType>bundle</supportedProjectType>
>    <supportedProjectType>jar</supportedProjectType>
>                             </supportedProjectTypes>
>                         </configuration>
>    <executions>
>                                     <execution>
>    <id>gen-bundle-manifest</id>
>                                         <goals>
>    <goal>manifest</goal>
>                                         </goals>
>    <phase>process-classes</phase>
>                                         <configuration>
>
>                                             <instructions>
>    <Permissions>all-permissions</Permissions>
> <Include-Resource>{maven-dependencies},{maven-resources},META-INF/LICENSE=LICENSE.txt</Include-Resource>
> <_removeheaders>Include-Resource,Private-Package,Ignore-Package</_removeheaders>
>                                             </instructions>
>                                         </configuration>
>                                     </execution>
>                     </plugin>
>
> anyone have experienced this issue ?
>
> thanks,
>
> Cristiano
>


-- 
Christian Schneider
http://www.liquid-reality.de

Open Source Architect
http://www.talend.com


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