You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@felix.apache.org by Tobi <K....@gmx.de> on 2009/07/22 22:05:56 UTC

maven-bundle-plugin: Import-Package not generated in manifest.mf?

Hi all,

I use the following configuration in my bundle POM which originally was developed as Eclipse PDE bundle:

      <plugin>
        <groupId>org.apache.felix</groupId>
        <artifactId>maven-bundle-plugin</artifactId>
          <executions>
            <execution>
              <id>bundle-manifest</id>
              <phase>process-classes</phase>
              <goals>
                <goal>manifest</goal>
              </goals>
            </execution>
          </executions>
        <configuration>
            <manifestLocation>${project.build.directory}/${project.build.finalName}/META-INF</manifestLocation>
           <supportedProjectTypes>
            <supportedProjectType>jar</supportedProjectType>
            <supportedProjectType>war</supportedProjectType>
           </supportedProjectTypes>
          <instructions>
            <Bundle-SymbolicName>${bundle.symbolicName}</Bundle-SymbolicName>
            <Bundle-Version>${pom.version}</Bundle-Version>

            <Bundle-Activator>${pom.artifactId}.Activator</Bundle-Activator>
            <Private-Package>de.*</Private-Package>
          </instructions>
        </configuration>
      </plugin>
      

The manifest.mf looks like that:
      
Manifest-Version: 1.0
Bundle-ClassPath: Bundle-ClassPath: .,WEB-INF/classes
Tool: Bnd-0.0.311
Bundle-Name: uiprototyp [de.domain]
Created-By: 1.6.0_12 (Sun Microsystems Inc.)
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-Vendor: vendor
Module-Type: dw-module
Bundle-Version: 0.1.0.SNAPSHOT
Bnd-LastModified: 1248291452312
Bundle-ManifestVersion: 2
Bundle-Activator: uiprototyp.Activator
Bundle-Description: my bundle
Import-Package: uiprototyp
Bundle-SymbolicName: uiprototyp
Bundle-DocURL: http://www.domain.de      


I am missing a lot of "Import-Package:" informations in the manifest.mf.

What could be the problem?


Regards
Tobi
-- 
GRATIS für alle GMX-Mitglieder: Die maxdome Movie-FLAT!
Jetzt freischalten unter http://portal.gmx.net/de/go/maxdome01

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


Re: maven-bundle-plugin: Import-Package not generated in manifest.mf?

Posted by Tobi <K....@gmx.de>.
Hi all,

my problem exists anymore. Any ideas?


Regards
Tobi

-------- Original-Nachricht --------
> Datum: Thu, 23 Jul 2009 13:24:18 +0200
> Von: "Tobi" <K....@gmx.de>
> An: users@felix.apache.org
> Betreff: Re: maven-bundle-plugin: Import-Package not generated in manifest.mf?

> Hi Alin,
> 
> thanks for your reply, but "mvn clean install" is not the solution.
> 
> 
> Regards
> Tobi
> 
> 
> -------- Original-Nachricht --------
> > Datum: Thu, 23 Jul 2009 13:43:17 +0300
> > Von: Alin Dreghiciu <ad...@gmail.com>
> > An: users@felix.apache.org
> > Betreff: Re: maven-bundle-plugin: Import-Package not generated in
> manifest.mf?
> 
> > Just a guess: try to build with "maven clean install", note the "clean".
> > It
> > can be that if the manifest is already there and includes already the
> > import
> > package, bnd will not rewrite it. As I look at your posted manifest does
> > not
> > look like all the info in he manifest is generated by bnd.
> > On Wed, Jul 22, 2009 at 11:05 PM, Tobi <K....@gmx.de> wrote:
> > 
> > > Hi all,
> > >
> > > I use the following configuration in my bundle POM which originally
> was
> > > developed as Eclipse PDE bundle:
> > >
> > >      <plugin>
> > >        <groupId>org.apache.felix</groupId>
> > >        <artifactId>maven-bundle-plugin</artifactId>
> > >          <executions>
> > >            <execution>
> > >              <id>bundle-manifest</id>
> > >              <phase>process-classes</phase>
> > >              <goals>
> > >                <goal>manifest</goal>
> > >              </goals>
> > >            </execution>
> > >          </executions>
> > >        <configuration>
> > >
> > > 
> >
> <manifestLocation>${project.build.directory}/${project.build.finalName}/META-INF</manifestLocation>
> > >           <supportedProjectTypes>
> > >            <supportedProjectType>jar</supportedProjectType>
> > >            <supportedProjectType>war</supportedProjectType>
> > >           </supportedProjectTypes>
> > >          <instructions>
> > >
> > >  <Bundle-SymbolicName>${bundle.symbolicName}</Bundle-SymbolicName>
> > >            <Bundle-Version>${pom.version}</Bundle-Version>
> > >
> > >           
> > <Bundle-Activator>${pom.artifactId}.Activator</Bundle-Activator>
> > >            <Private-Package>de.*</Private-Package>
> > >          </instructions>
> > >        </configuration>
> > >      </plugin>
> > >
> > >
> > > The manifest.mf looks like that:
> > >
> > > Manifest-Version: 1.0
> > > Bundle-ClassPath: Bundle-ClassPath: .,WEB-INF/classes
> > > Tool: Bnd-0.0.311
> > > Bundle-Name: uiprototyp [de.domain]
> > > Created-By: 1.6.0_12 (Sun Microsystems Inc.)
> > > Bundle-RequiredExecutionEnvironment: JavaSE-1.6
> > > Bundle-Vendor: vendor
> > > Module-Type: dw-module
> > > Bundle-Version: 0.1.0.SNAPSHOT
> > > Bnd-LastModified: 1248291452312
> > > Bundle-ManifestVersion: 2
> > > Bundle-Activator: uiprototyp.Activator
> > > Bundle-Description: my bundle
> > > Import-Package: uiprototyp
> > > Bundle-SymbolicName: uiprototyp
> > > Bundle-DocURL: http://www.domain.de
> > >
> > >
> > > I am missing a lot of "Import-Package:" informations in the
> manifest.mf.
> > >
> > > What could be the problem?
> > >
> > >
> > > Regards
> > > Tobi
> > > --
> > > GRATIS für alle GMX-Mitglieder: Die maxdome Movie-FLAT!
> > > Jetzt freischalten unter http://portal.gmx.net/de/go/maxdome01
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> > > For additional commands, e-mail: users-help@felix.apache.org
> > >
> > >
> > 
> > 
> > -- 
> > Alin Dreghiciu
> > Software Developer - Looking for new projects!
> > My profile: http://www.linkedin.com/in/alindreghiciu
> > My blog: http://adreghiciu.blogspot.com
> > http://www.ops4j.org - New Energy for OSS Communities - Open
> Participation
> > Software.
> > http://www.qi4j.org - New Energy for Java - Domain Driven Development.
> 
> -- 
> GRATIS für alle GMX-Mitglieder: Die maxdome Movie-FLAT!
> Jetzt freischalten unter http://portal.gmx.net/de/go/maxdome01
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org

-- 
Neu: GMX Doppel-FLAT mit Internet-Flatrate + Telefon-Flatrate
für nur 19,99 Euro/mtl.!* http://portal.gmx.net/de/go/dsl02

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


Re: maven-bundle-plugin: Import-Package not generated in manifest.mf?

Posted by Tobi <K....@gmx.de>.
Hi Alin,

thanks for your reply, but "mvn clean install" is not the solution.


Regards
Tobi


-------- Original-Nachricht --------
> Datum: Thu, 23 Jul 2009 13:43:17 +0300
> Von: Alin Dreghiciu <ad...@gmail.com>
> An: users@felix.apache.org
> Betreff: Re: maven-bundle-plugin: Import-Package not generated in manifest.mf?

> Just a guess: try to build with "maven clean install", note the "clean".
> It
> can be that if the manifest is already there and includes already the
> import
> package, bnd will not rewrite it. As I look at your posted manifest does
> not
> look like all the info in he manifest is generated by bnd.
> On Wed, Jul 22, 2009 at 11:05 PM, Tobi <K....@gmx.de> wrote:
> 
> > Hi all,
> >
> > I use the following configuration in my bundle POM which originally was
> > developed as Eclipse PDE bundle:
> >
> >      <plugin>
> >        <groupId>org.apache.felix</groupId>
> >        <artifactId>maven-bundle-plugin</artifactId>
> >          <executions>
> >            <execution>
> >              <id>bundle-manifest</id>
> >              <phase>process-classes</phase>
> >              <goals>
> >                <goal>manifest</goal>
> >              </goals>
> >            </execution>
> >          </executions>
> >        <configuration>
> >
> > 
> <manifestLocation>${project.build.directory}/${project.build.finalName}/META-INF</manifestLocation>
> >           <supportedProjectTypes>
> >            <supportedProjectType>jar</supportedProjectType>
> >            <supportedProjectType>war</supportedProjectType>
> >           </supportedProjectTypes>
> >          <instructions>
> >
> >  <Bundle-SymbolicName>${bundle.symbolicName}</Bundle-SymbolicName>
> >            <Bundle-Version>${pom.version}</Bundle-Version>
> >
> >           
> <Bundle-Activator>${pom.artifactId}.Activator</Bundle-Activator>
> >            <Private-Package>de.*</Private-Package>
> >          </instructions>
> >        </configuration>
> >      </plugin>
> >
> >
> > The manifest.mf looks like that:
> >
> > Manifest-Version: 1.0
> > Bundle-ClassPath: Bundle-ClassPath: .,WEB-INF/classes
> > Tool: Bnd-0.0.311
> > Bundle-Name: uiprototyp [de.domain]
> > Created-By: 1.6.0_12 (Sun Microsystems Inc.)
> > Bundle-RequiredExecutionEnvironment: JavaSE-1.6
> > Bundle-Vendor: vendor
> > Module-Type: dw-module
> > Bundle-Version: 0.1.0.SNAPSHOT
> > Bnd-LastModified: 1248291452312
> > Bundle-ManifestVersion: 2
> > Bundle-Activator: uiprototyp.Activator
> > Bundle-Description: my bundle
> > Import-Package: uiprototyp
> > Bundle-SymbolicName: uiprototyp
> > Bundle-DocURL: http://www.domain.de
> >
> >
> > I am missing a lot of "Import-Package:" informations in the manifest.mf.
> >
> > What could be the problem?
> >
> >
> > Regards
> > Tobi
> > --
> > GRATIS für alle GMX-Mitglieder: Die maxdome Movie-FLAT!
> > Jetzt freischalten unter http://portal.gmx.net/de/go/maxdome01
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> > For additional commands, e-mail: users-help@felix.apache.org
> >
> >
> 
> 
> -- 
> Alin Dreghiciu
> Software Developer - Looking for new projects!
> My profile: http://www.linkedin.com/in/alindreghiciu
> My blog: http://adreghiciu.blogspot.com
> http://www.ops4j.org - New Energy for OSS Communities - Open Participation
> Software.
> http://www.qi4j.org - New Energy for Java - Domain Driven Development.

-- 
GRATIS für alle GMX-Mitglieder: Die maxdome Movie-FLAT!
Jetzt freischalten unter http://portal.gmx.net/de/go/maxdome01

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


Re: Can't find resources in Require-Bundle,bug???

Posted by "Richard S. Hall" <he...@ungoverned.org>.
On 7/23/09 5:57 PM, tribon.cheng wrote:
> Thanks very much, Richard ,
>
> Yes, I need to export the meta-inf and it works! I had mistaked that resources needn't to be exported when using Require-Bundle
>    

No problem. Keep in mind that it is generally not a good approach to 
export meta-inf, since every bundle has this directory, so you end up 
with lots of bundles exporting it, but importers can only ever be wired 
to one of them.

Generally, if you need to look into meta-inf for resources, it usually 
calls on using the extender pattern to probe the bundles in response to 
their lifecycle events.

-> richard

> This is not a bug.
>
>
> 2009-07-24
>
>
>
>
>
>
> ● GBU-应用集成开发部 程操红
> ● 010-62435466
> ● 北京市海淀区北清路68号 用友软件园 3号楼033140
>
>
>
>
>
> 发件人: Richard S. Hall
> 发送时间: 2009-07-24  00:39:01
> 收件人: users
> 抄送:
> 主题: Re: Can't find resources in Require-Bundle,bug???
>
> On 7/23/09 8:06 AM, cch wrote:
>    
>> I have a bundle A, and it declare Require-Bundle:B bundle's symble name in manifest file.
>>
>> there is a resource(meta-inf/a.xml) in B bundle's jar.
>>
>> The bundle A can't find the resource!
>>
>>      
> Are you exporting "meta-inf" from bundle B?
>    
>> Look inside the source code of Felix 1.8.1:
>>
>> the "meta-inf" is not taken as a package, so it will return null directly.
>>
>>      
> I don't think this is the case. We don't do any sort of package naming
> verification when looking up resources. We just look for the last "/"
> and take everything before it as the package name, converting any
> remaining "/" characters to ".".
> ->  richard
>    
>> Enumeration org.apache.felix.framework.searchpolicy.R4WireModule.getResources(String name) throws ResourceNotFoundException
>>
>> public Enumeration getResources(String name) throws ResourceNotFoundException
>>       {
>>           // List to hold all enumerations from all package sources.
>>           List enums = new ArrayList();
>>           // Get the package of the target class.
>>           String pkgName = Util.getResourcePackage(name);
>>           // See if we have a resolved package for the resource's package.
>>           // If so, loop through all package sources and aggregate any
>>           // matching resource enumerations.
>>           ResolvedPackage rp = (ResolvedPackage) m_pkgMap.get(pkgName);
>>             if (rp != null)
>>           {
>>               for (int srcIdx = 0; srcIdx<   rp.m_sourceList.size(); srcIdx++)
>>               {
>>                   PackageSource ps = (PackageSource) rp.m_sourceList.get(srcIdx);
>>                   Enumeration urls = ps.m_module.getContentLoader().getResources(name);
>>                   if (urls != null)
>>                   {
>>                       enums.add(urls);
>>                   }
>>               }
>>               // Don't throw ResourceNotFoundException because module
>>               // dependencies support split packages.
>>           }
>>           return (enums.size() == 0)
>>               ? null
>>               : new CompoundEnumeration(
>>                   (Enumeration[]) enums.toArray(new Enumeration[enums.size()]));
>>       }
>>
>> 2009-07-23
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> 发件人: Tobi
>> 发送时间: 2009-07-23  19:17:45
>> 收件人: users
>> 抄送:
>> 主题: Re: maven-bundle-plugin: Import-Package not generated in manifest.mf?
>>
>> Hi Alin,
>> thanks for your reply, but "mvn clean install" is not the solution.
>> Regards
>> Tobi
>> -------- Original-Nachricht --------
>>
>>      
>>> Datum: Thu, 23 Jul 2009 13:43:17 +0300
>>> Von: Alin Dreghiciu<ad...@gmail.com>
>>> An: users@felix.apache.org
>>> Betreff: Re: maven-bundle-plugin: Import-Package not generated in manifest.mf?
>>> Just a guess: try to build with "maven clean install", note the "clean".
>>> It
>>> can be that if the manifest is already there and includes already the
>>> import
>>> package, bnd will not rewrite it. As I look at your posted manifest does
>>> not
>>> look like all the info in he manifest is generated by bnd.
>>> On Wed, Jul 22, 2009 at 11:05 PM, Tobi<K....@gmx.de>   wrote:
>>>
>>>
>>>        
>>>> Hi all,
>>>>
>>>> I use the following configuration in my bundle POM which originally was
>>>> developed as Eclipse PDE bundle:
>>>>
>>>>        <plugin>
>>>>          <groupId>org.apache.felix</groupId>
>>>>          <artifactId>maven-bundle-plugin</artifactId>
>>>>            <executions>
>>>>              <execution>
>>>>                <id>bundle-manifest</id>
>>>>                <phase>process-classes</phase>
>>>>                <goals>
>>>>                  <goal>manifest</goal>
>>>>                </goals>
>>>>              </execution>
>>>>            </executions>
>>>>          <configuration>
>>>>
>>>>
>>>>
>>>>          
>>> <manifestLocation>${project.build.directory}/${project.build.finalName}/META-INF</manifestLocation>
>>>
>>>        
>>>>             <supportedProjectTypes>
>>>>              <supportedProjectType>jar</supportedProjectType>
>>>>              <supportedProjectType>war</supportedProjectType>
>>>>             </supportedProjectTypes>
>>>>            <instructions>
>>>>
>>>>    <Bundle-SymbolicName>${bundle.symbolicName}</Bundle-SymbolicName>
>>>>              <Bundle-Version>${pom.version}</Bundle-Version>
>>>>
>>>>
>>>>
>>>>          
>>> <Bundle-Activator>${pom.artifactId}.Activator</Bundle-Activator>
>>>
>>>        
>>>>              <Private-Package>de.*</Private-Package>
>>>>            </instructions>
>>>>          </configuration>
>>>>        </plugin>
>>>>
>>>>
>>>> The manifest.mf looks like that:
>>>>
>>>> Manifest-Version: 1.0
>>>> Bundle-ClassPath: Bundle-ClassPath: .,WEB-INF/classes
>>>> Tool: Bnd-0.0.311
>>>> Bundle-Name: uiprototyp [de.domain]
>>>> Created-By: 1.6.0_12 (Sun Microsystems Inc.)
>>>> Bundle-RequiredExecutionEnvironment: JavaSE-1.6
>>>> Bundle-Vendor: vendor
>>>> Module-Type: dw-module
>>>> Bundle-Version: 0.1.0.SNAPSHOT
>>>> Bnd-LastModified: 1248291452312
>>>> Bundle-ManifestVersion: 2
>>>> Bundle-Activator: uiprototyp.Activator
>>>> Bundle-Description: my bundle
>>>> Import-Package: uiprototyp
>>>> Bundle-SymbolicName: uiprototyp
>>>> Bundle-DocURL: http://www.domain.de
>>>>
>>>>
>>>> I am missing a lot of "Import-Package:" informations in the manifest.mf.
>>>>
>>>> What could be the problem?
>>>>
>>>>
>>>> Regards
>>>> Tobi
>>>> --
>>>> GRATIS f黵 alle GMX-Mitglieder: Die maxdome Movie-FLAT!
>>>> Jetzt freischalten unter http://portal.gmx.net/de/go/maxdome01
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>>>> For additional commands, e-mail: users-help@felix.apache.org
>>>>
>>>>
>>>>
>>>>          
>>> -- 
>>> Alin Dreghiciu
>>> Software Developer - Looking for new projects!
>>> My profile: http://www.linkedin.com/in/alindreghiciu
>>> My blog: http://adreghiciu.blogspot.com
>>> http://www.ops4j.org - New Energy for OSS Communities - Open Participation
>>> Software.
>>> http://www.qi4j.org - New Energy for Java - Domain Driven Development.
>>>
>>>        
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
>
>    

Re: Re: Can't find resources in Require-Bundle,bug???

Posted by "tribon.cheng" <cc...@ufida.com.cn>.
Thanks very much, Richard ,

Yes, I need to export the meta-inf and it works! I had mistaked that resources needn't to be exported when using Require-Bundle

This is not a bug.


2009-07-24 






● GBU-应用集成开发部 程操红 
● 010-62435466     
● 北京市海淀区北清路68号 用友软件园 3号楼033140   





发件人: Richard S. Hall 
发送时间: 2009-07-24  00:39:01 
收件人: users 
抄送: 
主题: Re: Can't find resources in Require-Bundle,bug??? 
 
On 7/23/09 8:06 AM, cch wrote:
> I have a bundle A, and it declare Require-Bundle:B bundle's symble name in manifest file.
>
> there is a resource(meta-inf/a.xml) in B bundle's jar.
>
> The bundle A can't find the resource!
>    
Are you exporting "meta-inf" from bundle B?
> Look inside the source code of Felix 1.8.1:
>
> the "meta-inf" is not taken as a package, so it will return null directly.
>    
I don't think this is the case. We don't do any sort of package naming 
verification when looking up resources. We just look for the last "/" 
and take everything before it as the package name, converting any 
remaining "/" characters to ".".
-> richard
> Enumeration org.apache.felix.framework.searchpolicy.R4WireModule.getResources(String name) throws ResourceNotFoundException
>
> public Enumeration getResources(String name) throws ResourceNotFoundException
>      {
>          // List to hold all enumerations from all package sources.
>          List enums = new ArrayList();
>          // Get the package of the target class.
>          String pkgName = Util.getResourcePackage(name);
>          // See if we have a resolved package for the resource's package.
>          // If so, loop through all package sources and aggregate any
>          // matching resource enumerations.
>          ResolvedPackage rp = (ResolvedPackage) m_pkgMap.get(pkgName);
>            if (rp != null)
>          {
>              for (int srcIdx = 0; srcIdx<  rp.m_sourceList.size(); srcIdx++)
>              {
>                  PackageSource ps = (PackageSource) rp.m_sourceList.get(srcIdx);
>                  Enumeration urls = ps.m_module.getContentLoader().getResources(name);
>                  if (urls != null)
>                  {
>                      enums.add(urls);
>                  }
>              }
>              // Don't throw ResourceNotFoundException because module
>              // dependencies support split packages.
>          }
>          return (enums.size() == 0)
>              ? null
>              : new CompoundEnumeration(
>                  (Enumeration[]) enums.toArray(new Enumeration[enums.size()]));
>      }
>
> 2009-07-23
>
>
>
>
>
>
>
>
>
>
>
> 发件人: Tobi
> 发送时间: 2009-07-23  19:17:45
> 收件人: users
> 抄送:
> 主题: Re: maven-bundle-plugin: Import-Package not generated in manifest.mf?
>
> Hi Alin,
> thanks for your reply, but "mvn clean install" is not the solution.
> Regards
> Tobi
> -------- Original-Nachricht --------
>    
>> Datum: Thu, 23 Jul 2009 13:43:17 +0300
>> Von: Alin Dreghiciu<ad...@gmail.com>
>> An: users@felix.apache.org
>> Betreff: Re: maven-bundle-plugin: Import-Package not generated in manifest.mf?
>> Just a guess: try to build with "maven clean install", note the "clean".
>> It
>> can be that if the manifest is already there and includes already the
>> import
>> package, bnd will not rewrite it. As I look at your posted manifest does
>> not
>> look like all the info in he manifest is generated by bnd.
>> On Wed, Jul 22, 2009 at 11:05 PM, Tobi<K....@gmx.de>  wrote:
>>
>>      
>>> Hi all,
>>>
>>> I use the following configuration in my bundle POM which originally was
>>> developed as Eclipse PDE bundle:
>>>
>>>       <plugin>
>>>         <groupId>org.apache.felix</groupId>
>>>         <artifactId>maven-bundle-plugin</artifactId>
>>>           <executions>
>>>             <execution>
>>>               <id>bundle-manifest</id>
>>>               <phase>process-classes</phase>
>>>               <goals>
>>>                 <goal>manifest</goal>
>>>               </goals>
>>>             </execution>
>>>           </executions>
>>>         <configuration>
>>>
>>>
>>>        
>> <manifestLocation>${project.build.directory}/${project.build.finalName}/META-INF</manifestLocation>
>>      
>>>            <supportedProjectTypes>
>>>             <supportedProjectType>jar</supportedProjectType>
>>>             <supportedProjectType>war</supportedProjectType>
>>>            </supportedProjectTypes>
>>>           <instructions>
>>>
>>>   <Bundle-SymbolicName>${bundle.symbolicName}</Bundle-SymbolicName>
>>>             <Bundle-Version>${pom.version}</Bundle-Version>
>>>
>>>
>>>        
>> <Bundle-Activator>${pom.artifactId}.Activator</Bundle-Activator>
>>      
>>>             <Private-Package>de.*</Private-Package>
>>>           </instructions>
>>>         </configuration>
>>>       </plugin>
>>>
>>>
>>> The manifest.mf looks like that:
>>>
>>> Manifest-Version: 1.0
>>> Bundle-ClassPath: Bundle-ClassPath: .,WEB-INF/classes
>>> Tool: Bnd-0.0.311
>>> Bundle-Name: uiprototyp [de.domain]
>>> Created-By: 1.6.0_12 (Sun Microsystems Inc.)
>>> Bundle-RequiredExecutionEnvironment: JavaSE-1.6
>>> Bundle-Vendor: vendor
>>> Module-Type: dw-module
>>> Bundle-Version: 0.1.0.SNAPSHOT
>>> Bnd-LastModified: 1248291452312
>>> Bundle-ManifestVersion: 2
>>> Bundle-Activator: uiprototyp.Activator
>>> Bundle-Description: my bundle
>>> Import-Package: uiprototyp
>>> Bundle-SymbolicName: uiprototyp
>>> Bundle-DocURL: http://www.domain.de
>>>
>>>
>>> I am missing a lot of "Import-Package:" informations in the manifest.mf.
>>>
>>> What could be the problem?
>>>
>>>
>>> Regards
>>> Tobi
>>> --
>>> GRATIS f黵 alle GMX-Mitglieder: Die maxdome Movie-FLAT!
>>> Jetzt freischalten unter http://portal.gmx.net/de/go/maxdome01
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>>> For additional commands, e-mail: users-help@felix.apache.org
>>>
>>>
>>>        
>> -- 
>> Alin Dreghiciu
>> Software Developer - Looking for new projects!
>> My profile: http://www.linkedin.com/in/alindreghiciu
>> My blog: http://adreghiciu.blogspot.com
>> http://www.ops4j.org - New Energy for OSS Communities - Open Participation
>> Software.
>> http://www.qi4j.org - New Energy for Java - Domain Driven Development.
>>      
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org
 

Re: Can't find resources in Require-Bundle,bug???

Posted by "Richard S. Hall" <he...@ungoverned.org>.

On 7/23/09 8:06 AM, cch wrote:
> I have a bundle A, and it declare Require-Bundle:B bundle's symble name in manifest file.
>
> there is a resource(meta-inf/a.xml) in B bundle's jar.
>
> The bundle A can't find the resource!
>    

Are you exporting "meta-inf" from bundle B?

> Look inside the source code of Felix 1.8.1:
>
> the "meta-inf" is not taken as a package, so it will return null directly.
>    

I don't think this is the case. We don't do any sort of package naming 
verification when looking up resources. We just look for the last "/" 
and take everything before it as the package name, converting any 
remaining "/" characters to ".".

-> richard

> Enumeration org.apache.felix.framework.searchpolicy.R4WireModule.getResources(String name) throws ResourceNotFoundException
>
> public Enumeration getResources(String name) throws ResourceNotFoundException
>      {
>          // List to hold all enumerations from all package sources.
>          List enums = new ArrayList();
>          // Get the package of the target class.
>          String pkgName = Util.getResourcePackage(name);
>          // See if we have a resolved package for the resource's package.
>          // If so, loop through all package sources and aggregate any
>          // matching resource enumerations.
>          ResolvedPackage rp = (ResolvedPackage) m_pkgMap.get(pkgName);
>            if (rp != null)
>          {
>              for (int srcIdx = 0; srcIdx<  rp.m_sourceList.size(); srcIdx++)
>              {
>                  PackageSource ps = (PackageSource) rp.m_sourceList.get(srcIdx);
>                  Enumeration urls = ps.m_module.getContentLoader().getResources(name);
>                  if (urls != null)
>                  {
>                      enums.add(urls);
>                  }
>              }
>              // Don't throw ResourceNotFoundException because module
>              // dependencies support split packages.
>          }
>          return (enums.size() == 0)
>              ? null
>              : new CompoundEnumeration(
>                  (Enumeration[]) enums.toArray(new Enumeration[enums.size()]));
>      }
>
> 2009-07-23
>
>
>
>
>
>
>
>
>
>
>
> 发件人: Tobi
> 发送时间: 2009-07-23  19:17:45
> 收件人: users
> 抄送:
> 主题: Re: maven-bundle-plugin: Import-Package not generated in manifest.mf?
>
> Hi Alin,
> thanks for your reply, but "mvn clean install" is not the solution.
> Regards
> Tobi
> -------- Original-Nachricht --------
>    
>> Datum: Thu, 23 Jul 2009 13:43:17 +0300
>> Von: Alin Dreghiciu<ad...@gmail.com>
>> An: users@felix.apache.org
>> Betreff: Re: maven-bundle-plugin: Import-Package not generated in manifest.mf?
>> Just a guess: try to build with "maven clean install", note the "clean".
>> It
>> can be that if the manifest is already there and includes already the
>> import
>> package, bnd will not rewrite it. As I look at your posted manifest does
>> not
>> look like all the info in he manifest is generated by bnd.
>> On Wed, Jul 22, 2009 at 11:05 PM, Tobi<K....@gmx.de>  wrote:
>>
>>      
>>> Hi all,
>>>
>>> I use the following configuration in my bundle POM which originally was
>>> developed as Eclipse PDE bundle:
>>>
>>>       <plugin>
>>>         <groupId>org.apache.felix</groupId>
>>>         <artifactId>maven-bundle-plugin</artifactId>
>>>           <executions>
>>>             <execution>
>>>               <id>bundle-manifest</id>
>>>               <phase>process-classes</phase>
>>>               <goals>
>>>                 <goal>manifest</goal>
>>>               </goals>
>>>             </execution>
>>>           </executions>
>>>         <configuration>
>>>
>>>
>>>        
>> <manifestLocation>${project.build.directory}/${project.build.finalName}/META-INF</manifestLocation>
>>      
>>>            <supportedProjectTypes>
>>>             <supportedProjectType>jar</supportedProjectType>
>>>             <supportedProjectType>war</supportedProjectType>
>>>            </supportedProjectTypes>
>>>           <instructions>
>>>
>>>   <Bundle-SymbolicName>${bundle.symbolicName}</Bundle-SymbolicName>
>>>             <Bundle-Version>${pom.version}</Bundle-Version>
>>>
>>>
>>>        
>> <Bundle-Activator>${pom.artifactId}.Activator</Bundle-Activator>
>>      
>>>             <Private-Package>de.*</Private-Package>
>>>           </instructions>
>>>         </configuration>
>>>       </plugin>
>>>
>>>
>>> The manifest.mf looks like that:
>>>
>>> Manifest-Version: 1.0
>>> Bundle-ClassPath: Bundle-ClassPath: .,WEB-INF/classes
>>> Tool: Bnd-0.0.311
>>> Bundle-Name: uiprototyp [de.domain]
>>> Created-By: 1.6.0_12 (Sun Microsystems Inc.)
>>> Bundle-RequiredExecutionEnvironment: JavaSE-1.6
>>> Bundle-Vendor: vendor
>>> Module-Type: dw-module
>>> Bundle-Version: 0.1.0.SNAPSHOT
>>> Bnd-LastModified: 1248291452312
>>> Bundle-ManifestVersion: 2
>>> Bundle-Activator: uiprototyp.Activator
>>> Bundle-Description: my bundle
>>> Import-Package: uiprototyp
>>> Bundle-SymbolicName: uiprototyp
>>> Bundle-DocURL: http://www.domain.de
>>>
>>>
>>> I am missing a lot of "Import-Package:" informations in the manifest.mf.
>>>
>>> What could be the problem?
>>>
>>>
>>> Regards
>>> Tobi
>>> --
>>> GRATIS f黵 alle GMX-Mitglieder: Die maxdome Movie-FLAT!
>>> Jetzt freischalten unter http://portal.gmx.net/de/go/maxdome01
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>>> For additional commands, e-mail: users-help@felix.apache.org
>>>
>>>
>>>        
>> -- 
>> Alin Dreghiciu
>> Software Developer - Looking for new projects!
>> My profile: http://www.linkedin.com/in/alindreghiciu
>> My blog: http://adreghiciu.blogspot.com
>> http://www.ops4j.org - New Energy for OSS Communities - Open Participation
>> Software.
>> http://www.qi4j.org - New Energy for Java - Domain Driven Development.
>>      

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


Can't find resources in Require-Bundle,bug???

Posted by cch <cc...@ufida.com.cn>.
I have a bundle A, and it declare Require-Bundle:B bundle's symble name in manifest file.

there is a resource(meta-inf/a.xml) in B bundle's jar. 

The bundle A can't find the resource!

Look inside the source code of Felix 1.8.1:

the "meta-inf" is not taken as a package, so it will return null directly.

Enumeration org.apache.felix.framework.searchpolicy.R4WireModule.getResources(String name) throws ResourceNotFoundException

public Enumeration getResources(String name) throws ResourceNotFoundException
    {
        // List to hold all enumerations from all package sources.
        List enums = new ArrayList();
        // Get the package of the target class.
        String pkgName = Util.getResourcePackage(name);
        // See if we have a resolved package for the resource's package.
        // If so, loop through all package sources and aggregate any
        // matching resource enumerations.
        ResolvedPackage rp = (ResolvedPackage) m_pkgMap.get(pkgName);
          if (rp != null)
        {
            for (int srcIdx = 0; srcIdx < rp.m_sourceList.size(); srcIdx++)
            {
                PackageSource ps = (PackageSource) rp.m_sourceList.get(srcIdx);
                Enumeration urls = ps.m_module.getContentLoader().getResources(name);
                if (urls != null)
                {
                    enums.add(urls);
                }
            }
            // Don't throw ResourceNotFoundException because module
            // dependencies support split packages.
        }
        return (enums.size() == 0)
            ? null
            : new CompoundEnumeration(
                (Enumeration[]) enums.toArray(new Enumeration[enums.size()]));
    }

2009-07-23 











发件人: Tobi 
发送时间: 2009-07-23  19:17:45 
收件人: users 
抄送: 
主题: Re: maven-bundle-plugin: Import-Package not generated in manifest.mf? 
 
Hi Alin,
thanks for your reply, but "mvn clean install" is not the solution.
Regards
Tobi
-------- Original-Nachricht --------
> Datum: Thu, 23 Jul 2009 13:43:17 +0300
> Von: Alin Dreghiciu <ad...@gmail.com>
> An: users@felix.apache.org
> Betreff: Re: maven-bundle-plugin: Import-Package not generated in manifest.mf?
> Just a guess: try to build with "maven clean install", note the "clean".
> It
> can be that if the manifest is already there and includes already the
> import
> package, bnd will not rewrite it. As I look at your posted manifest does
> not
> look like all the info in he manifest is generated by bnd.
> On Wed, Jul 22, 2009 at 11:05 PM, Tobi <K....@gmx.de> wrote:
> 
> > Hi all,
> >
> > I use the following configuration in my bundle POM which originally was
> > developed as Eclipse PDE bundle:
> >
> >      <plugin>
> >        <groupId>org.apache.felix</groupId>
> >        <artifactId>maven-bundle-plugin</artifactId>
> >          <executions>
> >            <execution>
> >              <id>bundle-manifest</id>
> >              <phase>process-classes</phase>
> >              <goals>
> >                <goal>manifest</goal>
> >              </goals>
> >            </execution>
> >          </executions>
> >        <configuration>
> >
> > 
> <manifestLocation>${project.build.directory}/${project.build.finalName}/META-INF</manifestLocation>
> >           <supportedProjectTypes>
> >            <supportedProjectType>jar</supportedProjectType>
> >            <supportedProjectType>war</supportedProjectType>
> >           </supportedProjectTypes>
> >          <instructions>
> >
> >  <Bundle-SymbolicName>${bundle.symbolicName}</Bundle-SymbolicName>
> >            <Bundle-Version>${pom.version}</Bundle-Version>
> >
> >           
> <Bundle-Activator>${pom.artifactId}.Activator</Bundle-Activator>
> >            <Private-Package>de.*</Private-Package>
> >          </instructions>
> >        </configuration>
> >      </plugin>
> >
> >
> > The manifest.mf looks like that:
> >
> > Manifest-Version: 1.0
> > Bundle-ClassPath: Bundle-ClassPath: .,WEB-INF/classes
> > Tool: Bnd-0.0.311
> > Bundle-Name: uiprototyp [de.domain]
> > Created-By: 1.6.0_12 (Sun Microsystems Inc.)
> > Bundle-RequiredExecutionEnvironment: JavaSE-1.6
> > Bundle-Vendor: vendor
> > Module-Type: dw-module
> > Bundle-Version: 0.1.0.SNAPSHOT
> > Bnd-LastModified: 1248291452312
> > Bundle-ManifestVersion: 2
> > Bundle-Activator: uiprototyp.Activator
> > Bundle-Description: my bundle
> > Import-Package: uiprototyp
> > Bundle-SymbolicName: uiprototyp
> > Bundle-DocURL: http://www.domain.de
> >
> >
> > I am missing a lot of "Import-Package:" informations in the manifest.mf.
> >
> > What could be the problem?
> >
> >
> > Regards
> > Tobi
> > --
> > GRATIS f黵 alle GMX-Mitglieder: Die maxdome Movie-FLAT!
> > Jetzt freischalten unter http://portal.gmx.net/de/go/maxdome01
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> > For additional commands, e-mail: users-help@felix.apache.org
> >
> >
> 
> 
> -- 
> Alin Dreghiciu
> Software Developer - Looking for new projects!
> My profile: http://www.linkedin.com/in/alindreghiciu
> My blog: http://adreghiciu.blogspot.com
> http://www.ops4j.org - New Energy for OSS Communities - Open Participation
> Software.
> http://www.qi4j.org - New Energy for Java - Domain Driven Development.
-- 
GRATIS f黵 alle GMX-Mitglieder: Die maxdome Movie-FLAT!
Jetzt freischalten unter http://portal.gmx.net/de/go/maxdome01
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org
 

Re: maven-bundle-plugin: Import-Package not generated in manifest.mf?

Posted by Alin Dreghiciu <ad...@gmail.com>.
Just a guess: try to build with "maven clean install", note the "clean". It
can be that if the manifest is already there and includes already the import
package, bnd will not rewrite it. As I look at your posted manifest does not
look like all the info in he manifest is generated by bnd.
On Wed, Jul 22, 2009 at 11:05 PM, Tobi <K....@gmx.de> wrote:

> Hi all,
>
> I use the following configuration in my bundle POM which originally was
> developed as Eclipse PDE bundle:
>
>      <plugin>
>        <groupId>org.apache.felix</groupId>
>        <artifactId>maven-bundle-plugin</artifactId>
>          <executions>
>            <execution>
>              <id>bundle-manifest</id>
>              <phase>process-classes</phase>
>              <goals>
>                <goal>manifest</goal>
>              </goals>
>            </execution>
>          </executions>
>        <configuration>
>
>  <manifestLocation>${project.build.directory}/${project.build.finalName}/META-INF</manifestLocation>
>           <supportedProjectTypes>
>            <supportedProjectType>jar</supportedProjectType>
>            <supportedProjectType>war</supportedProjectType>
>           </supportedProjectTypes>
>          <instructions>
>
>  <Bundle-SymbolicName>${bundle.symbolicName}</Bundle-SymbolicName>
>            <Bundle-Version>${pom.version}</Bundle-Version>
>
>            <Bundle-Activator>${pom.artifactId}.Activator</Bundle-Activator>
>            <Private-Package>de.*</Private-Package>
>          </instructions>
>        </configuration>
>      </plugin>
>
>
> The manifest.mf looks like that:
>
> Manifest-Version: 1.0
> Bundle-ClassPath: Bundle-ClassPath: .,WEB-INF/classes
> Tool: Bnd-0.0.311
> Bundle-Name: uiprototyp [de.domain]
> Created-By: 1.6.0_12 (Sun Microsystems Inc.)
> Bundle-RequiredExecutionEnvironment: JavaSE-1.6
> Bundle-Vendor: vendor
> Module-Type: dw-module
> Bundle-Version: 0.1.0.SNAPSHOT
> Bnd-LastModified: 1248291452312
> Bundle-ManifestVersion: 2
> Bundle-Activator: uiprototyp.Activator
> Bundle-Description: my bundle
> Import-Package: uiprototyp
> Bundle-SymbolicName: uiprototyp
> Bundle-DocURL: http://www.domain.de
>
>
> I am missing a lot of "Import-Package:" informations in the manifest.mf.
>
> What could be the problem?
>
>
> Regards
> Tobi
> --
> GRATIS für alle GMX-Mitglieder: Die maxdome Movie-FLAT!
> Jetzt freischalten unter http://portal.gmx.net/de/go/maxdome01
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
>
>


-- 
Alin Dreghiciu
Software Developer - Looking for new projects!
My profile: http://www.linkedin.com/in/alindreghiciu
My blog: http://adreghiciu.blogspot.com
http://www.ops4j.org - New Energy for OSS Communities - Open Participation
Software.
http://www.qi4j.org - New Energy for Java - Domain Driven Development.