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<[email protected]>
>> An: [email protected]
>> 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<[email protected]> 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: [email protected]
>>> For additional commands, e-mail: [email protected]
>>>
>>>
>>>
>> --
>> 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: [email protected]
For additional commands, e-mail: [email protected]