The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

ErikEngerd (11) [Avatar] Offline
#1
Hi,


I am getting problems importing the chapter 1 projects into eclipse. I am trying to import the moduler, lifecycle, and service projects into eclipse separately. To do this I select create new Java project from existing source and enable nested modules using the maven plugin.

I then get compilation errors in Main.java for lifecycle and service because of an inconsistency of the Constants class. In particular, the version that is part of org.apache.felix.framework version 1.4 has the FRAMEWORK_STORAGE_CLEAN constant but the one from the osgi_R4_core version 1.0 does not have it.

The only way to set it up is to generate separate eclipse projects for each subproject (mvn eclipse:m2eclipse), but to make that work, the artifactIds in the poms must be given hard names like service-main instead of ${bundle.symbolicName}. In that way, the conflict can be avoided, but the conflict still exists since apparently different versions of OSGI are used in the examples.

Cheers
Erik
stuart.mcculloch (29) [Avatar] Offline
#2
Re: Constants.FRAMEWORK_STORAGE_CLEAN
> I am getting problems importing the chapter 1
> projects into eclipse. I am trying to import the
> moduler, lifecycle, and service projects into eclipse
> separately. To do this I select create new Java
> project from existing source and enable nested
> modules using the maven plugin.

Hi Erik,

This is a very cumbersome way of loading the projects because you will
have to sort out the correct build path each time - especially as you are
using the plain JDT view instead of the OSGi enabled Eclipse/PDE view.

Both sets of examples (the old Maven build and the new Ant build) have
instructions (see the top-level README.txt) explaining how to generate
Eclipse project files for the examples - these generated files will always
have the correct build path (at least that's our goal)

Try "ant pde" with the latest build - this should generate Eclipse project
files that you can then import into Eclipse as _existing_ projects

note: there is one project I think that might report an error in Eclipse/PDE
because of a missing embedded class, but that's fixed in our local build
that I hope to upload tomorrow and only affects one of the later examples

> I then get compilation errors in Main.java for
> lifecycle and service because of an inconsistency of
> the Constants class. In particular, the version that
> is part of org.apache.felix.framework version 1.4 has
> the FRAMEWORK_STORAGE_CLEAN constant but the one from
> the osgi_R4_core version 1.0 does not have it.

Yes, this is because our launcher uses a new constant introduced in 4.2
which has not yet been officially released - so you need to make sure you
have the right ordering on your build path (like the ordering used to compile
the code in Maven)

> The only way to set it up is to generate separate
> eclipse projects for each subproject (mvn
> eclipse:m2eclipse), but to make that work, the
> artifactIds in the poms must be given hard names like
> service-main instead of ${bundle.symbolicName}. In
> that way, the conflict can be avoided, but the
> conflict still exists since apparently different
> versions of OSGI are used in the examples.

Well you would want separate Eclipse projects because each sub-project is
supposed to be a separate bundle, and this is best represented as separate
Eclipse/PDE plug-in projects (because Eclipse doesn't handle multi-module
projects very well)

If you generate the Eclipse/PDE files and "import" them, it should all work

HTH

> Cheers
> Erik