felix-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Justin Edelson <jus...@justinedelson.com>
Subject Re: Missing Constraint: Import-Package
Date Tue, 20 Jul 2010 16:09:41 GMT
In this context, the OSGi container is Eclipse/Equinox, so you just need to
install the peaberry bundles. The peaberry docs should explain how to do
this.

The entire concept of a fat or uber jar is anathema to OSGi IMHO.

You might also want to look at Tycho which seems closer to your use case.
But I don't do Eclipse development, so I can't say more than that.

Justin

On Tue, Jul 20, 2010 at 11:20 AM, motes motes <mort.motes@gmail.com> wrote:

> Thanks for clarifying!
>
> Maybe its appropriate to write a few words on what I am trying to do.
> I have made a fairly large offline application which use the eclipse
> birt runtime library.  I want this application to work as an eclipse
> plugin (PDE) which can be installed into eclipse using eg the P2
> updater. Its not meant to run outside eclipse.
>
> My first approach was to use maven to build a fat jar with the
> assembly plugin and then convert this fatjar into a plugin using the
> "Plugin from existing jar archieve" from eclipse. Finally this plugin
> was added as a dependency in a "pure" eclipse plugin project which
> could then be exported using the wizard and installed in eclipse.
>
> But I would like to skip the step of building the fatjar and manually
> converting it into a bundle. Instead I would like to use the
> maven-bundle-plugin to do this automatically from maven.
>
> But as I understand your mail this requires setting up an OSGI
> container, loading the necessary bundles and then starting the "main"
> bundle.
>
> I have looked into:
>
>
> http://www.sonatype.com/books/mcookbook/reference/osgi-sect-starting-osgi-container.html
>
> http://www.sonatype.com/books/mcookbook/reference/sect-osgi-generate-project.html
> http://www.ops4j.org/projects/pax/construct/maven-pax-plugin/
>
> which shows how to create a maven bundle project and start the Felix
> osgi container. But I am a bit confused if this is the right way to go
> based on the above described objective (the final application should
> be an eclipse only plugin). Any suggestions?
>
>
>
>
>
>
>
>
> On Tue, Jul 20, 2010 at 4:18 PM, Justin Edelson
> <justin@justinedelson.com> wrote:
> > I answered a similar question a few days ago:
> > http://markmail.org/message/e6zor7dgzyf4ykka
> >
> > <http://markmail.org/message/e6zor7dgzyf4ykka>In short, you appear to be
> > conflating Maven dependencies (expressed in the pom, used at compile/test
> > time) with OSGi dependencies (expressed in the manifest, used at
> runtime).
> >
> > In order to use peaberry, you need to deploy the peaberry bundles into
> your
> > OSGi container. In the peaberry-1.1.1 download, these are:
> > aopalliance-1.0.jar
> > guice-customloader-20090412.jar
> > peaberry-1.1.1.jar
> >
> > That you are seeing a missing import for an internal class suggests to me
> > you're still using Embed-Dependencies, which isn't necessary (or a good
> > idea) in this case.
> >
> > Justin
> >
> > On Tue, Jul 20, 2010 at 9:32 AM, motes motes <mort.motes@gmail.com>
> wrote:
> >
> >> I have now changed my project to depend on:
> >>
> >> org.ops4j : peaberry : 1.1.1 : jar
> >>
> >> instead of guice-2.0 which should be the OSGI version of guice. But I
> >> still get the error:
> >>
> >>  Missing Constraint: Import-Package:
> >> com.google.inject.internal.asm.util; version="0.0.0"
> >>
> >> when I try to start the bundle from the OSGI  commandline. Has anyone
> >> had any success using the maven-bundle-plugin with a project that use
> >> guice or peaberry?
> >>
> >>
> >>
> >>
> >> On Tue, Jul 20, 2010 at 2:58 PM, motes motes <mort.motes@gmail.com>
> wrote:
> >> > If I do:
> >> >
> >> >
>  <Import-Package>!com.google.inject.internal.asm.util,*</Import-Package>
> >> >
> >> > I just get a similar error for another package:
> >> >
> >> >  Missing Constraint: Import-Package: javax.jms;
> >> >
> >> > so yes its best to track it down I guess. But I thought that
> >> >
> >> >               <Embed-Transitive>true</Embed-Transitive>
> >> >
>  <Embed-Dependency>*;scope=compile|runtime</Embed-Dependency>
> >> >
> >> > would take care of transitive dependencies?
> >> >
> >> >
> >> >
> >> > On Tue, Jul 20, 2010 at 2:44 PM, Justin Edelson <
> justinedelson@gmail.com>
> >> wrote:
> >> >> You can suppress this import by adding
> >> <Import-Package>!com.google.inject.internal.asm.util,*</Import-Package>
> >> >>
> >> >> But this import looks important, so you are probably better off
> tracking
> >> it down.
> >> >>
> >> >> Also, isn't there an OSGi-ified version of Guice you can use instead
> of
> >> embedding it?
> >> >>
> >> >> On Jul 20, 2010, at 8:34 AM, motes motes <mort.motes@gmail.com>
> wrote:
> >> >>
> >> >>> I am trying to build my maven project into a bundle using the
> >> >>> maven-bundle-plugin with all its dependencies (it depends on
> >> >>> guice-2.0.jar). In my pom file I have:
> >> >>>
> >> >>>   <build>
> >> >>>    <plugins>
> >> >>>        <plugin>
> >> >>>            <groupId>org.apache.felix</groupId>
> >> >>>            <artifactId>maven-bundle-plugin</artifactId>
> >> >>>            <version>2.1.0</version>
> >> >>>           <extensions>true</extensions>
> >> >>>           <configuration>
> >> >>>              <instructions>
> >> >>>
> >> >>>
> >>
> <Bundle-SymbolicName>${pom.groupId}.${pom.artifactId}</Bundle-SymbolicName>
> >> >>>                  <Bundle-Name>${pom.name}</Bundle-Name>
> >> >>>                  <Bundle-Version>${pom.version}</Bundle-Version>
> >> >>>
> >>  <Bundle-Activator>com.generator.Activator</Bundle-Activator>
> >> >>>                  <Private-Package>com.generator</Private-Package>
> >> >>>                  <Embed-Transitive>true</Embed-Transitive>
> >> >>>
> >>  <Embed-Dependency>*;scope=compile|runtime</Embed-Dependency>
> >> >>>              </instructions>
> >> >>>           </configuration>
> >> >>>        </plugin>
> >> >>>    </plugins>
> >> >>>   </build>
> >> >>>
> >> >>> After building the project using mvn install I get a jar file with
> all
> >> >>> the dependencies. I then try to run it through the OSGI console
> after
> >> >>> installing it but I get the error:
> >> >>>
> >> >>> osgi> start 15
> >> >>> org.osgi.framework.BundleException: The bundle
> >> >>> "com.generator_1.1.1.SNAPSHOT [15]" could not be resolved. Reason:
> >> >>> Missing Constraint: Import-Package:
> >> >>> com.google.inject.internal.asm.util; version="0.0.0"
> >> >>>        at
> >>
> org.eclipse.osgi.framework.internal.core.AbstractBundle.getResolverError(AbstractBundle.java:1317)
> >> >>>        at
> >>
> org.eclipse.osgi.framework.internal.core.AbstractBundle.getResolutionFailureException(AbstractBundle.java:1301)
> >> >>>        at
> >>
> org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHost.java:319)
> >> >>>        at
> >>
> org.eclipse.osgi.framework.internal.core.AbstractBundle.start(AbstractBundle.java:284)
> >> >>>        at
> >>
> org.eclipse.osgi.framework.internal.core.AbstractBundle.start(AbstractBundle.java:276)
> >> >>>        at
> >>
> org.eclipse.osgi.framework.internal.core.FrameworkCommandProvider._start(FrameworkCommandProvider.java:252)
> >> >>>        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
> Method)
> >> >>>        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown
> Source)
> >> >>>        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown
> >> Source)
> >> >>>        at java.lang.reflect.Method.invoke(Unknown Source)
> >> >>>        at
> >>
> org.eclipse.osgi.framework.internal.core.FrameworkCommandInterpreter.execute(FrameworkCommandInterpreter.java:155)
> >> >>>        at
> >>
> org.eclipse.osgi.framework.internal.core.FrameworkConsole.docommand(FrameworkConsole.java:156)
> >> >>>        at
> >>
> org.eclipse.osgi.framework.internal.core.FrameworkConsole.runConsole(FrameworkConsole.java:141)
> >> >>>        at
> >>
> org.eclipse.osgi.framework.internal.core.FrameworkConsole.run(FrameworkConsole.java:105)
> >> >>>        at java.lang.Thread.run(Unknown Source)
> >> >>>
> >> >>> osgi>
> >> >>>
> >> >>> The problem seems to be related to the
> >> >>> com.google.inject.internal.asm.util package but I have not been
able
> >> >>> to find that package anywhere (not even in  guice-2.0.jar). Any
> ideas
> >> >>> on how to solve this problem?
> >> >>>
> >> >>>
> ---------------------------------------------------------------------
> >> >>> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> >> >>> For additional commands, e-mail: users-help@felix.apache.org
> >> >>>
> >> >>
> >> >> ---------------------------------------------------------------------
> >> >> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> >> >> For additional commands, e-mail: users-help@felix.apache.org
> >> >>
> >> >>
> >> >
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> >> For additional commands, e-mail: users-help@felix.apache.org
> >>
> >>
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message