pombreda / google-guice

Automatically exported from code.google.com/p/google-guice
Apache License 2.0
0 stars 1 forks source link

Fix OSGI metadata in latest Maven build #799

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Building latest master with Maven produces OSGi metadata that contains some 
unwanted imports. This is because the build now jarjars the classes after 
generation of the manifest instead of before, so the manifest imports both ASM 
and CGLIB. It also has J2SE-1.5 in its Bundle-RequiredExecutionEnvironment, 
despite the binary now being 1.6+. Finally it contains unwanted version ranges 
for Guava imports that unnecessarily constrain them to versions between 16.0 
and 17.0.

Proposed patch:

 * remove J2SE-1.5 from Bundle-RequiredExecutionEnvironment
 * remove unwanted CGLIB and ASM imports
 * remove version ranges from Guava imports

diff --git a/pom.xml b/pom.xml
index dece81f..06ad0f7 100644
--- a/pom.xml
+++ b/pom.xml
@@ -245,10 +245,8 @@ See the Apache License Version 2.0 for the specific 
language governing permissio
               <Bundle-DocURL>http://code.google.com/p/google-guice/</Bundle-DocURL>
               <Bundle-Name>${project.artifactId}</Bundle-Name>
               <Bundle-SymbolicName>$(module)</Bundle-SymbolicName>
-              <Bundle-RequiredExecutionEnvironment>
-                J2SE-1.5,JavaSE-1.6
-              </Bundle-RequiredExecutionEnvironment>
-              <Import-Package>!com.google.inject.*,*</Import-Package>
+              
<Bundle-RequiredExecutionEnvironment>JavaSE-1.6</Bundle-RequiredExecutionEnviron
ment>
+              
<Import-Package>!net.sf.cglib.*,!org.objectweb.asm.*,!com.google.inject.*,*</Imp
ort-Package>
               <_exportcontents>!*.internal.*,$(module).*;version=${guice.api.version}</_exportcontents>
               <_versionpolicy>[$(version;==;$(@)),$(version;+;$(@)))</_versionpolicy>
               <_nouses>true</_nouses>
@@ -260,6 +258,10 @@ See the Apache License Version 2.0 for the specific 
language governing permissio
                 Ignore-Package,Bnd-LastModified
               </_removeheaders>
             </instructions>
+            <!--
+             | Exclude from version calculations, as it doesn't use semantic 
versioning
+            -->
+            <excludeDependencies>guava</excludeDependencies>
           </configuration>
           <executions>
             <execution>

Original issue reported on code.google.com by mccu...@gmail.com on 10 Mar 2014 at 3:45

GoogleCodeExporter commented 9 years ago
4.0-beta4 do not work under Equinox because of this issue. I see the following 
output:

!ENTRY org.eclipse.equinox.p2.director 2 0 2014-03-21 16:45:30.817
!MESSAGE Problems resolving provisioning plan.
!SUBENTRY 1 org.eclipse.equinox.p2.director 2 0 2014-03-21 16:45:30.817
!MESSAGE Unable to satisfy dependency from com.google.inject 4.0.0.beta4 to 
package net.sf.cglib.core 0.0.0.
!SUBENTRY 1 org.eclipse.equinox.p2.director 2 0 2014-03-21 16:45:30.817
!MESSAGE Unable to satisfy dependency from com.google.inject 4.0.0.beta4 to 
package net.sf.cglib.proxy 0.0.0.
!SUBENTRY 1 org.eclipse.equinox.p2.director 2 0 2014-03-21 16:45:30.817
!MESSAGE Unable to satisfy dependency from com.google.inject 4.0.0.beta4 to 
package net.sf.cglib.reflect 0.0.0.
!SUBENTRY 1 org.eclipse.equinox.p2.director 2 0 2014-03-21 16:45:30.818
!MESSAGE Unable to satisfy dependency from com.google.inject 4.0.0.beta4 to 
package org.objectweb.asm [5.0.0,6.0.0).

Please apply the proposed patch before releasing 4.0.

Original comment by Ash2kk@gmail.com on 21 Mar 2014 at 12:12

GoogleCodeExporter commented 9 years ago
Thanks for the report, and patch Stuart.  And thanks @Ash2kk for your 
confirmation of failure in Equinox.  Can you verify that the patch fixes the 
issues you're seeing?  It seems they would, but it would be nice to have 
positive verification.

Either way, we'll pull in this patch.  We need to figure out some way to do a 
more robust OSGI test so we can avoid these sorts of things. :/

Original comment by cgruber@google.com on 21 Mar 2014 at 5:29