mrszj / google-guice

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

Depend on javax.inject and aopalliance provided by apache servicemix which have OSGI metadata. #704

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
those two artifacts packed by apache servicemix are valid OSGi bundle, so in 
order to ease integrating of guice in to OSGi env, please depend on them 
instead of the original ones.

<dependency>
  <groupId>org.apache.servicemix.bundles</groupId>
  <artifactId>org.apache.servicemix.bundles.javax-inject</artifactId>
  <version>1_2</version>
</dependency>
<dependency>
  <groupId>org.apache.servicemix.bundles</groupId>
  <artifactId>org.apache.servicemix.bundles.aopalliance</artifactId>
  <version>1.0_6</version>
</dependency>

Original issue reported on code.google.com by hxliang1...@gmail.com on 9 May 2012 at 12:53

GoogleCodeExporter commented 9 years ago
This won't happen, as depending on these would result in multiple copies of 
these classes in people's classpaths, since many people will depend on both 
guice and javax.inject explicitly, because they will have libraries which use 
both javax.inject.Inject and com.google.inject.ImplementedBy (or other 
combinations).  

Because of this, a change to those dependencies would result in 
javax.inject:inject AND 
org.apache.servicemix.bundles:org.apache.servicemix.bundles.javax-inject 
appearing in the classpath, and the projects would have to start implementing 
exclusions. 

The correct answer would be for projects who need both maven and osgi to 
explicitly depend on the artifacts you mention above, and possibly for 
cleanliness, exclude javax.inject:inject and aopalliance's "official" jars. 

Original comment by cgruber@google.com on 5 Jun 2012 at 2:54

GoogleCodeExporter commented 9 years ago
Alright, agree with you since the major group of users are not using guice 
together with osgi. But anyway, I hope there would be something described in 
wiki that how to deal with this situation, because not everybody know about 
apache servicemix.

Original comment by hxliang1...@gmail.com on 5 Jun 2012 at 3:12

GoogleCodeExporter commented 9 years ago
Yes, and Eclipse Orbit p2 repository also apparently has javax.inject and 
aopalliance osgi deps.

anyway http://code.google.com/p/google-guice/issues/detail?id=615 covers the 
documentation thing, so I'll actually re-close this as a dupe of that. 

Original comment by cgruber@google.com on 6 Jun 2012 at 3:32