Bug 54455

Summary: DynamicImport-Package in MANIFEST.MF not working in Eclipse
Product: Log4j - Now in Jira Reporter: Dave Hartnoll <dhartnoll>
Component: OtherAssignee: log4j-dev <log4j-dev>
Status: NEW ---    
Severity: normal CC: dhartnoll
Priority: P2    
Version: 1.2.17   
Target Milestone: ---   
Hardware: All   
OS: All   

Description Dave Hartnoll 2013-01-21 15:51:17 UTC
The "DynamicImport-Package: *" attribute in MANIFEST.MF appears to be ineffective in Eclipse (Juno (4.2) SR1, other releases not checked).

One possible reason for the failure is that the attribute is included within an individual-section* (i.e. after the Name: value) line, and not within the main-section* of the manifest. I've tried moving the DynamicImport-Package to the Main Section and that resolves my problem (DI-P behaves as I expect).

* See http://docs.oracle.com/javase/7/docs/technotes/guides/jar/jar.html#JAR%20Manifest for a definition of these terms.

To clarify, I changed this:

[...]
Bundle-SymbolicName: log4j
Import-Package: javax.jmdns;resolution:=optional,javax.jms;resolution:
 =optional,javax.mail;resolution:=optional,javax.mail.internet;resolut
 ion:=optional,javax.management,javax.naming,javax.xml.parsers,org.w3c
 .dom,org.xml.sax,org.xml.sax.helpers

Name: org.apache.log4j
DynamicImport-Package: *
Implementation-Vendor: "Apache Software Foundation"
[...]

... to this ...

[...]
Bundle-SymbolicName: log4j
Import-Package: javax.jmdns;resolution:=optional,javax.jms;resolution:
 =optional,javax.mail;resolution:=optional,javax.mail.internet;resolut
 ion:=optional,javax.management,javax.naming,javax.xml.parsers,org.w3c
 .dom,org.xml.sax,org.xml.sax.helpers
DynamicImport-Package: *

Name: org.apache.log4j
Implementation-Vendor: "Apache Software Foundation"
[...]

Also, removing the blank line before "Name: ..." seems to work.

I noticed some changes to Name for 1.2.18: in Bug 44370, but making those changes has no effect on DI-P behaviour.

There's also some relevant discussion in Bug 43282 but I think this is a separate issue.