2009/7/15 Lewis, Eric <[email protected]>

> So, I tried the pax:eclipse plugin as a substitute for eclipse:eclipse.
>
> First of all, I'm confused about the only configuration parameter which
> seems useful to me, 'fixDependencies'.
> If it's a switch, why isn't it a boolean? Default is EXTERNAL, but what
> else is there?
>

long story, basically we had to support different policies regarding which
dependencies are 'fixed'

( fixing means changing the automatic type applied by the
maven-eclipse-plugin so that they're
  treated as normal Eclipse dependencies rather than OSGi dependencies -
this is because the
  maven-eclipse-plugin assumes Eclipse will do the wiring for OSGi
dependencies via the target
  platform, but this is not always true - especially when you have test
classes in your project )

Anyway, I see that everything is copied over to target/pax-eclipse and
> partially unpacked.
>
> But things are done multiple times... Here are my dependencies:
> [INFO] ch.ipi:esvclient-serverlib:bundle:1.0.0-SNAPSHOT
> [INFO] +- ch.ipi:util-type:jar:1.0.0-SNAPSHOT:compile
> [INFO] |  +- commons-lang:commons-lang:jar:2.4:compile
> [INFO] |  +- ch.ipi:util-global:jar:1.0.0-SNAPSHOT:compile
> [INFO] |  +- findbugs:annotations:jar:1.0.0:compile
> [INFO] |  \- com.google.code.findbugs:jsr305:jar:1.3.8:compile
> [INFO] +- junit:junit:jar:4.5:test
> [INFO] +- ch.qos.logback:logback-classic:jar:0.9.14:test
> [INFO] |  \- ch.qos.logback:logback-core:jar:0.9.14:test
> [INFO] \- org.slf4j:slf4j-api:jar:1.5.6:test (scope not updated to compile)
>
> I get the following .classpath, where that dreaded M2_REPO is used again
> :-)


well that's par for the course - the maven-eclipse-plugin code uses the
M2_REPO variable
so that project files can be shared between teams (it doesn't expect that
you'll be copying
the files locally) - I guess we could remove the entries as they're not
strictly required now,
but up to now no-one's really had an issue with them

   mvn -Declipse.workspace=<path-to-eclipse-workspace>
eclipse:add-maven-repo

will set the M2_REPO variable for you in Eclipse (or you can add this
variable manually)

Also for instance annotations-1.0.0.jar is used twice (plus unpacked as
> well)
>
> <classpath>
>  <classpathentry path="target/classes" kind="output"/>
>  <classpathentry path="org.eclipse.jdt.launching.JRE_CONTAINER"
> kind="con"/>
>  <classpathentry path="org.eclipse.pde.core.requiredPlugins" kind="con"/>
>  <classpathentry
> path="M2_REPO/findbugs/annotations/1.0.0/annotations-1.0.0.jar" kind="var"/>
>  <classpathentry
> path="M2_REPO/commons-lang/commons-lang/2.4/commons-lang-2.4.jar"
> kind="var"/>
>  <classpathentry
> path="M2_REPO/com/google/code/findbugs/jsr305/1.3.8/jsr305-1.3.8.jar"
> kind="var"/>
>  <classpathentry path="M2_REPO/junit/junit/4.5/junit-4.5.jar" kind="var"/>
>  <classpathentry
> path="M2_REPO/ch/qos/logback/logback-classic/0.9.14/logback-classic-0.9.14.jar"
> kind="var"/>
>  <classpathentry
> path="M2_REPO/ch/qos/logback/logback-core/0.9.14/logback-core-0.9.14.jar"
> kind="var"/>
>  <classpathentry
> path="M2_REPO/org/slf4j/slf4j-api/1.5.6/slf4j-api-1.5.6.jar" kind="var"/>
>  <classpathentry
> path="M2_REPO/ch/ipi/util-global/1.0.0-SNAPSHOT/util-global-1.0.0-SNAPSHOT.jar"
> kind="var"/>
>  <classpathentry
> path="M2_REPO/ch/ipi/util-type/1.0.0-SNAPSHOT/util-type-1.0.0-SNAPSHOT.jar"
> kind="var"/>
>  <classpathentry path="target/pax-eclipse" exported="true" kind="lib"/>
>  <classpathentry path="target/pax-eclipse/util-global-1.0.0-SNAPSHOT.jar"
> exported="true" kind="lib"/>
>  <classpathentry path="target/pax-eclipse/commons-lang-2.4.jar"
> exported="true" kind="lib"/>
>  <classpathentry path="target/pax-eclipse/jsr305-1.3.8.jar" exported="true"
> kind="lib"/>
>  <classpathentry path="target/pax-eclipse/annotations-1.0.0.jar"
> exported="true" kind="lib"/>
>  <classpathentry path="target/pax-eclipse/util-type-1.0.0-SNAPSHOT.jar"
> exported="true" kind="lib"/>
> </classpath>
>
> Since I do my own dependency copying, I now have the same artefact four
> times


well the whole point of the pax:eclipse goal is that you don't need to do
your own copying ;)


> - in the root as JAR


you shouldn't need this anymore if you decide to use the pax plugin


> - in the M2_REPO as JAR


this is another side-effect of building on the maven-eclipse-plugin code,
again we could
remove this entry as you're embedding it but it hasn't caused any problems
so we just
leave it there

also note that the M2_REPO is your local Maven repository, so you'll always
have jars
sitting there because that's how Maven works...


> - in the target/pax-eclipse as JAR


ok, this is the expected embedded dependency as "munged" by the pax-plugin


> - in the target/pax-eclipse/... as class
>

and this is an inlined class because you're still using
<Export-Package>*</Export-Package>


> So... still not there, it seems.
>

well removing your own copying of dependencies and using <_exportcontents>
instead
of <Export-Package> should remove most of the extraneous entries - the
M2_REPO
classpath entries that related to embedded dependencies could also be
removed by
a small tweak to the pax-plugin code, but from experience they're mostly
harmless

I've received your example project, will send you some suggested changes

-- 
Cheers, Stuart

Best regards,
> Eric
>
>
> >
> > Yes, I'm now down to one (!) dependency (and its transitive
> > dependencies) - still doesn't work (26 errors).
> >
> > >
> > > Now, I know that these packages do exist in the
> > dependencies, so it's
> > > > probably some kind of misconfiguration. One of the RCP
> > > developers mentioned
> > > > that the 'uses:=' part might be the troublemaker...?
> > >
> > >
> > > yes, PDE doesn't like excessive "uses" constraint (but there are
> > > places where you need them to avoid potential loader problems)
> > >
> > > it's only when you're exporting lots of inter-related packages that
> > > the "uses" constraints becomes an issue, I've never had trouble
> > > using them with plug-ins that export well-defined APIs
> > >
> > > to turn it off put <_nouses>true</_nouses> in your Bnd instructions
> >
> > Thanks, but first I'll try the maven-pax-plugin.
> >
> > >
> > > Also, I'm generating an Eclipse PDE project as described on
> > > the Felix page,
> > > > but really, it's a total mess.
> > > > Only about a third of the dependencies are in the visible
> > > 'Referenced
> > > > Libraries', about half of them use the M2_REPO environment
> > > variable, the
> > > > rest is hard-coded as linked resource in the .project file,
> > > and of course
> > > > all of them point to my local Maven repo instead of the project!
> > >
> > >
> > > well that's the Eclipse plug-in for you - which is why I
> > adapted it in
> > > the maven-pax-plugin to try and improve the project metadata for
> > > OSGi / plug-in projects
> >
> > I'll try that next.
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>

Reply via email to