On 8 October 2010 14:10, Stanislav Ochotnicky <[email protected]>wrote:
> Hi,
>
> I am currently in the process of packaging Maven 3 and all its
> dependencies for Fedora. I encountered few things in org.sonatype.sisu
> pom.xml that I don't entirely understand.
>
> This is the main directory structure:
> .
> ├── guice-bean
> │ ├── guice-bean-binders
> │ ├── guice-bean-containers
> │ ├── guice-bean-converters
> │ ├── guice-bean-inject
> │ ├── guice-bean-locators
> │ ├── guice-bean-reflect
> │ ├── guice-bean-scanners
> │ └── sisu-inject-bean
> └── guice-plexus
> ├── guice-plexus-binders
> ├── guice-plexus-converters
> ├── guice-plexus-locators
> ├── guice-plexus-metadata
> ├── guice-plexus-scanners
> ├── guice-plexus-shim
> └── sisu-inject-plexus
>
>
> sisu-inject-bean and sisu-inject plexus seem to be bundling and shading
> rest of their group respectively (plus few other libraries such as
> objectweb-asm, javax.inject and some plexus parts).
>
if you want the individual component jars then use guice-plexus-shim
and it will have the appropriate dependencies
however, you will end up with a lot of small jars so for convenience
the sisu-inject-* projects assemble the modules into a single bundle
along with OSGi metadata - the dependencies for this are adjusted
so you won't get duplicates of all the contained modules
this makes it easier to deploy and update the jars on platforms such
as OSGi where the modules form a logical group that should always
be updated at the same time
> What I don't understand is why was this approach used instead of
> standard dependency resolution of maven (addding libraries into
> <dependency> section or similar).
think of this as the equivalent of having small sub-projects which
are then assembled into a larger WAR file - it's exactly the same
except here we use the bundle-plugin to do the assembly instead
of the assembly-plugin
> For the reference I am adding part of
> sisu-inject-plexus pom.xml containing settings for bundle and shade
> plugin. I am guessing it might have something to do with the way bundle
> plugin is used, but I'd rather know for sure.
>
> -------------
> <build>
> <plugins>
> <plugin>
> <groupId>org.apache.felix</groupId>
> <artifactId>maven-bundle-plugin</artifactId>
> <extensions>true</extensions>
> <configuration>
> <excludeDependencies>
> <!-- fragment host and external dependencies -->
> sisu-inject-bean,*;groupId=org.codehaus.plexus
> </excludeDependencies>
> <instructions>
> <Bundle-SymbolicName>
> org.sonatype.inject.plexus
> </Bundle-SymbolicName>
> <Fragment-Host>
> org.sonatype.inject
> </Fragment-Host>
> <Export-Package>
>
> org.codehaus.plexus.*;-noimport:=true;-split-package:=merge-first
> </Export-Package>
> <Private-Package>
> META-INF.plexus,org.sonatype.guice.*,org.objectweb.asm
> </Private-Package>
> </instructions>
> </configuration>
> </plugin>
> <plugin>
> <artifactId>maven-shade-plugin</artifactId>
> <executions>
> <execution>
> <phase>package</phase>
> <goals>
> <goal>shade</goal>
> </goals>
> <configuration>
> <artifactSet>
> <includes>
>
> <include>${project.groupId}:${project.artifactId}</include>
> </includes>
> </artifactSet>
> <relocations>
> <relocation>
> <pattern>org.objectweb</pattern>
> <shadedPattern>org.sonatype.guice</shadedPattern>
> </relocation>
> </relocations>
> <filters>
> <filter>
> <artifact>*:*</artifact>
> <includes>
> <include>META-INF/**</include>
> <include>org/codehaus/plexus/**</include>
> <include>org/sonatype/guice/plexus/**</include>
> <include>org/objectweb/asm/*Writer*</include>
> </includes>
> </filter>
> </filters>
> </configuration>
> </execution>
> </executions>
> </plugin>
> </plugins>
> </build>
> ----------------
>
> --
> Stanislav Ochotnicky <[email protected]>
> Associate Software Engineer - Base Operating Systems Brno
>
> PGP: 71A1677C
> Red Hat Inc. http://cz.redhat.com
>
>
--
Cheers, Stuart