Maven, Deploying Bundles and Transitive Dependency Management
Interested to know if anyone can point me to a hopefully automated solution to this problem.
Given any mavenized project that has dependencies, and assuming those dependencies are all OSGi-ready bundles, each with some of their own transitive dependencies, is there a way to get a PAR to pick up ALL of the dependencies at once and wrap them up such that I can deploy my whole app with its dependencies at once?
Put simply, I'm lazy, and don't want to have to copy bundles manually to the dm server repository folder, and especially don't want to force my development team to have to do this as well (tho I seem to recall we could configure dm server to point to a shared repo location). Whenever I update my POM to add a new dependency, I'd rather hot have ANOTHER step where I need to go grab that JAR and throw it somewhere else manually.
From what I can see, the Eclipse PAR management will only allow me to package projects I can point it to - and those projects' transitive dependencies are not pulled into the PAR.
If I use the maven PAR plugin, the same basic thing happens - per its documentation it will only include in the PAR those dependencies I explicitly refer to, it will not deal with transitive dependencies.
Am I missing something? Or do I need to bite the bullet and either do this manually (copying my dependencies somewhere or writing my own automation for this)?
A development focused approach...
Although not ideal in your scenario where "deployment" of the par isn't necessarily the same as the system building the par (ie. having all the depend resources in once nicely organised "release" folder). You could always just have your dm-server point to your internal *OSGI SAFE* maven repository(s)...
We currently have an internal osgi safe repo an our local build bundle repo which a local instance of the dm server references.
This works quite well for development (sans the fighting of the dm-server bundles vs the repo bundles (which is where I break down and cry))
But I too would like a nicer description of the ideal "release scenario" with respect to deploying on an "out of the box" dm server.
I also forgot to mention that the maven dependency plugin also has a transitive dependency inclustion feature which might help you...(merging all the dependencies used in a project hierarchy is something i'll leave to you)
Code:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/dependencies</outputDirectory>
<overWriteReleases>false</overWriteReleases>
<overWriteSnapshots>false</overWriteSnapshots>
<overWriteIfNewer>true</overWriteIfNewer>
</configuration>
</execution>
</executions>
</plugin>
Doing just that for now...
Thanks bjc, that's just what we ended up doing for now, but it's not quite what I'd *like* to do. Your comment about an OSGi-safe repo threw me for a little bit until we experimented by just pointing the server to our local repo (that contains both bundles and jars). No love there - Spring dm Server balks at the first non-bundle it finds and quits right there.
I put in an enhancement request for that - http://forum.springsource.org/showth...026#post264026. I'd be interested to know if you think that thread is promoting a good idea or something with hidden dangers/potholes. This osgi business is still quite new to me other than reading about it every year for the past few years. :)