[ 
https://issues.apache.org/jira/browse/LOG4J2-345?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13748345#comment-13748345
 ] 

Roland Weiglhofer commented on LOG4J2-345:
------------------------------------------

Index: pom.xml
===================================================================
--- pom.xml     (revision 1516096)
+++ pom.xml     (working copy)
@@ -142,6 +142,8 @@
     <!-- Configuration properties for the OSGi maven-bundle-plugin -->
     
<osgi.symbolicName>org.apache.logging.${project.artifactId}</osgi.symbolicName>
     
<osgi.export>org.apache.logging.log4j.*;version=${project.version};-noimport:=true</osgi.export>
+    
<osgi.export.slf4jbinding>org.slf4j.impl;version=1.7.5,org.slf4j.helpers;version=1.7.5,org.apache.logging.slf4j;version=${project.version}</osgi.export.slf4jbinding>
+    
<osgi.export.log4j1.2>org.apache.log4j;version=1.2,org.apache.log4j.helpers;version=1.2,org.apache.log4j.config;version=1.2,org.apache.log4j.spi;version=1.2,org.apache.log4j.xml;version=1.2</osgi.export.log4j1.2>
     <osgi.import>*</osgi.import>
     <osgi.dynamicImport />
     <osgi.private />
Index: log4j12-api/pom.xml
===================================================================
--- log4j12-api/pom.xml (revision 1516096)
+++ log4j12-api/pom.xml (working copy)
@@ -24,7 +24,7 @@
     <relativePath>../</relativePath>
   </parent>
   <artifactId>log4j-1.2-api</artifactId>
-  <packaging>jar</packaging>
+  <packaging>bundle</packaging>
   <name>Apache Log4j 1.x Compatibility API</name>
   <description>The Log4j 1.x Compatibility API</description>
   <properties>
@@ -55,6 +55,22 @@
   </dependencies>
   <build>
     <plugins>
+      <plugin>
+        <groupId>org.apache.felix</groupId>
+        <artifactId>maven-bundle-plugin</artifactId>
+        <extensions>true</extensions>
+        <inherited>true</inherited>
+        <configuration>
+          <instructions>
+            <Bundle-SymbolicName>${osgi.symbolicName}</Bundle-SymbolicName>
+            <Export-Package>${osgi.export.log4j1.2}</Export-Package>
+            <Private-Package>${osgi.private}</Private-Package>
+            <Import-Package>${osgi.import}</Import-Package>
+            
<DynamicImport-Package>${osgi.dynamicImport}</DynamicImport-Package>
+            <Bundle-DocURL>${project.url}</Bundle-DocURL>
+          </instructions>
+        </configuration>
+      </plugin>
       <!-- Include the standard NOTICE and LICENSE -->
       <plugin>
         <groupId>org.apache.maven.plugins</groupId>
                
> logging.log4j-1.2-api doesn't export the log4j API 1.2. Dependent bundles can 
> not be resolved.
> ----------------------------------------------------------------------------------------------
>
>                 Key: LOG4J2-345
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-345
>             Project: Log4j 2
>          Issue Type: Bug
>          Components: log4j 1.2 emulation
>    Affects Versions: 2.0-beta4, 2.0-beta8, 2.0-beta9
>         Environment: OSGi / Apache Felix 4.x
>            Reporter: Roland Weiglhofer
>              Labels: Bundle, Export-Package, Log4j-1.2, Maven-Bundle-Plugin, 
> OSGi, POM
>             Fix For: 2.0-beta9, 2.0
>
>         Attachments: log4j2 1.2api.patch
>
>
> Hi all Log4j/OSGi experts!
> Yesterday I started to migrate from log4j to log4j2. I replaced all Log4j 1.x 
> bundles with log4j-1.2-api as described here: 
> http://logging.apache.org/log4j/2.x/log4j-1.2-api/index.html
> But I got following error:
> Unresolved constraint in bundle MyBundle [21]: Unable to resolve 21.0: 
> missing requirement [21.0] osgi.wiring.package; 
> (&(osgi.wiring.package=org.apache.log4j)(version>=1.2.0)(!(version>=2.0.0)))
> so...I checked the capabilities of the log4j-1.2-api bundle:
> g! inspect cap * 11
> org.apache.logging.log4j-1.2-api [11] provides:
> -----------------------------------------------
> osgi.wiring.bundle; org.apache.logging.log4j-1.2-api 2.0.0.beta8 [UNUSED]
> osgi.wiring.host; org.apache.logging.log4j-1.2-api 2.0.0.beta8 [UNUSED]
> As you can see logging.log4j-1.2-api doesn't export the log4j API 1.2. It 
> still requires log4j 1.2. All dependent bundles can not be resolved until I 
> add the old log4j.jar.
> The maven-bundle-plugin does not export the packages.
> Roland 

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to