Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [tycho-user] How do I import a bundle-packaged project into Eclipse for debug?

m2e/tycho needs Embedded-Artifacts bundle manifest header to work
properly for wrapper bundles. You should be able to enable it in
m2e-specific profile, if you don't want this header included in bundle
jars produced during command line build. But I just keep the header in
my bundles. It does not hurt anything.

--
Regards,
Igor




On 2014-10-25, 14:24, Lee Carver wrote:
Hi Igor -

Attached is a small zip file will all the parts.  There is a
bundle-parent project that provides several Maven definitions, a
BundleGuava project that should be the simple "wrapper" project, and a
BundleUser project that should be launchable as an Eclipse application.
Maven build all three (in order above), import the projects into
Eclipse, and try to launch the BundleUser project (from an Eclipse sample).

When I click on the provided action (the Eclipse icon), I get the
"java.lang.ClassNotFoundException: com.google.common.base.Joiner cannot
be found by BundleUser_1.0.0.qualifier".

This should be nearly identical to the zip file attached in the original
email.  Some small tweaks to BundleGuava project.  This was created by
cp -r of  my sample projects, deleting the .git and */target
directories, and zip -r over the remaining tree.

I'm actually working on a much larger project (DepAn), with 8+
third-party libraries (asm, guava, jogl, joda, jung, xstream, etc.).
Having a systematic scheme for creating third party libraries in Maven
versus using hacked-up custom Eclipse builds will be a boon for
generating releases.

Thanks for taking the time to look into the details.
    Lee

On Fri, Oct 24, 2014 at 5:33 PM, Igor Fedorenko <igor@xxxxxxxxxxxxxx
<mailto:igor@xxxxxxxxxxxxxx>> wrote:

    Please provide complete standalone example and exact steps to reproduce
    the problem and I'll have a look.

    --
    Regards,
    Igor


    On 2014-10-24, 19:42, Lee Carver wrote:

        I must be missing something here.  My attempts to import a wrapper
        bundle still lead to a run-time ClassNotFoundException when I try to
        debug the sample application that is attached.

        I've reduced the BundleGuava project down to just a pom.xml
        file.  This
        eliminated the .project, .classpath, and META-INF/MANIFEST files
        that
        had been present in the project.  I think this packaging is
        identical to
        the packaging for the
        itp02/build01/pomfirst-__thirdparyt/pom.xml.  I do
        not have any project that resembles the
        itp02/build01/pomfirst-bundle/__pom.xml.

        When I import the BundleGuava project as an existing Maven
        project, the
        .project and .classpath files where created from scratch.  The
        Tycho and
        Eclipse compilers seem happy with this arrangement.

        However, when I try to launch the BundleUser as an Eclipse
        application,
        I get this exception:

        java.lang.__NoClassDefFoundError: com/google/common/base/Joiner
        Caused by: java.lang.__ClassNotFoundException:
        com.google.common.base.Joiner cannot be found by
        BundleUser_1.0.0.qualifier

        Although I've imported BundleGuava as an Existing Maven Project,
        the IDE
        does not seem to recognize it as a project that can be added to the
        build.  I note that is is not listed in the Debug Configuration
        page for
        Plugins.  Although I can add it a a project for the build
        dependencies,
        it does not seem to be recognized as a Workspace plugin.

        I sure I'm omitting one essential Maven attribute on some
        configuration
        page.  And I'd sure appreciate some help figuring out which
        attribute thats.

        (I'm using Guava as an example.  In my RPC application, I have a
        large
        number of more exotic libraries.  Regardless, I look forward to
        using an
        externally packaged Guava in the future.)

        Here's the pom.xml for BundleGuava:

        <projectxmlns="http://maven.__apache.org/POM/4.0.0
        <http://maven.apache.org/POM/4.0.0>"xmlns:__xsi="http://www.w3.org/2001/__XMLSchema-instance
        <http://www.w3.org/2001/XMLSchema-instance>"xsi:__schemaLocation="http://maven.__apache.org/POM/4.0.0
        <http://maven.apache.org/POM/4.0.0>

        http://maven.apache.org/xsd/__maven-4.0.0.xsd
        <http://maven.apache.org/xsd/maven-4.0.0.xsd>">
        <modelVersion>4.0.0</__modelVersion>
        <parent>
        <groupId>org.demo.bundle</__groupId>
        <artifactId>bundle-parent</__artifactId>
        <version>0.0.1-SNAPSHOT</__version>
        <relativePath>../bundle-__parent/pom.xml</relativePath>
        </parent>

        <artifactId>BundleGuava</__artifactId>
        <version>1.0.0-SNAPSHOT</__version>
        <packaging>bundle</packaging>

        <properties>
        <guava.version>18.0</guava.__version>
        </properties>

        <dependencies>
        <dependency>
        <groupId>com.google.guava</__groupId>
        <artifactId>guava</artifactId>
        <version>${guava.version}</__version>
        </dependency>
        </dependencies>

        <build>
        <sourceDirectory>src</__sourceDirectory>
        <plugins>
        <plugin>
        <artifactId>maven-compiler-__plugin</artifactId>
        <version>3.1</version>
        <configuration>
        <source>1.6</source>
        <target>1.6</target>
        </configuration>
        </plugin>

        <plugin>
        <groupId>org.apache.felix</__groupId>
        <artifactId>maven-bundle-__plugin</artifactId>
        <version>2.5.3</version>
        <extensions>true</extensions>
        <configuration>
        <instructions>
        <Embed-Dependency>*;scope=__compile|runtime</Embed-__Dependency>
        <_nouses>true</_nouses>
        <_exportcontents>com.google.__common.*</_exportcontents>
        <_removeheaders>
                        Import-Package,
                        Embed-Dependency,
                        Embedded-Artifacts,
                        Private-Package
        </_removeheaders>
        </instructions>
        </configuration>
        </plugin>
        </plugins>
        </build>

        </project>


        On Fri, Oct 24, 2014 at 12:58 PM, Igor Fedorenko
        <igor@xxxxxxxxxxxxxx <mailto:igor@xxxxxxxxxxxxxx>
        <mailto:igor@xxxxxxxxxxxxxx <mailto:igor@xxxxxxxxxxxxxx>>> wrote:

             Have a look at tycho wiki [1], pomfirst-thirdparty is an
        example of what
             I called "wrapper" bundle. In your case, you have bundle
        that "wraps"
             guava. You just import such projects as existing Maven
        Projects in
             eclipse, and everything should just work.

             [1]
        https://wiki.eclipse.org/____Tycho/How_Tos/Dependency_on_____pom-first_artifacts
        <https://wiki.eclipse.org/__Tycho/How_Tos/Dependency_on___pom-first_artifacts>

        <https://wiki.eclipse.org/__Tycho/How_Tos/Dependency_on___pom-first_artifacts
        <https://wiki.eclipse.org/Tycho/How_Tos/Dependency_on_pom-first_artifacts>>

             --
             Regards,
             Igor

             On 2014-10-24, 15:35, Lee Carver wrote:

                 Igor -

                 How do I create the "wrapper" bundle?  Just including the
                 dependency on
                 the BundleGuava "bundling" project does not get the Eclipse
                 workspace right.

                 Do I need to create a separate Eclipse project?
        Exactly how
                 should it
                 be set up?  Is there an example in the m2e code base?

                 Thanks
                      Lee

                 On Fri, Oct 24, 2014 at 12:12 PM, Igor Fedorenko
                 <igor@xxxxxxxxxxxxxx <mailto:igor@xxxxxxxxxxxxxx>
        <mailto:igor@xxxxxxxxxxxxxx <mailto:igor@xxxxxxxxxxxxxx>>
                 <mailto:igor@xxxxxxxxxxxxxx
        <mailto:igor@xxxxxxxxxxxxxx> <mailto:igor@xxxxxxxxxxxxxx
        <mailto:igor@xxxxxxxxxxxxxx>>>> wrote:

                      Sadly, PDE does not provide API to implement this, but
                 there are two
                      workarounds

                      * If you have m2e/tycho integration installed, you can
                 import your
                      "wrapper" bundles in Eclipse workspace and these
        bundle
                 projects should
                      become available for other projects. This is what
        I usually do.

                      * Alternatively, you can copy these wrapper bundle to
                      <eclipse-install>/dropins folder. They should become
                 available for other
                      workspace projects after eclipse restart.

                      --
                      Regards,
                      Igor


                      On 2014-10-24, 15:02, Lee Carver wrote:

                          I'm trying to use Maven and m2e to develop an RCP
                 client that
                          includes
                          several third-partly libraries. In the past,
        I've been
                 able to
                          use the
                          custom plugin builds and a local repository of
                 third-party jars,
                          but I
                          was hoping to do better with Maven.

                          As a minimal example, I've tried to package a
        recent
                 Google Guava
                          release as a third-party OSGi component.  I
        create the
                 component
                          with
                          "bundle" packages, and the
        target/../BundleGuava..jar
                 has all the
                          expected components.  The rest of the details
        are in the
                          attached zip,
                          but the bundle instructions are:

                                  <plugin>

          <groupId>org.apache.felix</______groupId>

          <artifactId>maven-bundle-______plugin</artifactId>
                                    <version>2.5.3</version>
                                    <extensions>true</extensions>
                                    <configuration>
                                      <instructions>

          <Embed-Dependency>*</Embed-______Dependency>
                                        <Export-Package>
                                          com.google.common.*
                                        </Export-Package>
                                        <_nouses>true</_nouses>
                                        <_removeheaders>
                                          Embed-Dependency,
                                          Embedded-Artifacts,
                                          Import-Package,
                                          Private-Package
                                        </_removeheaders>
                                      </instructions>
                                    </configuration>
                                  </plugin>

                          However, I cannot get the client plugin,
        GuavaUser, to
                 properly
                          accept
                          the new module.  I thought that the following
                 dependency would
                          make the
                          artifact from above available in Eclipse.

                              <dependencies>
                                <dependency>
                                  <groupId>org.demo.bundle</______groupId>
                                  <artifactId>BundleGuava</______artifactId>
                                  <version>1.0.0-SNAPSHOT</______version>
                                </dependency>
                              </dependencies>

                          The Maven build appears to work fine, but
        Eclipse reports
                          problems.  The
                          sample call for Joiner.on(", ").join("Hello",
        "world")
                 turns into an
                          ClassNotFoundException.

                          I'd like to do most of my debugging in the
        Eclipse IDE
                          environment, but
                          that would require successful launches from
        the Eclipse
                          debugger.  What
                          is the best way to make the bundled
        third-party library
                          available to the
                          Eclipse IDE.



          _____________________________________________________
                          tycho-user mailing list
        tycho-user@xxxxxxxxxxx <mailto:tycho-user@xxxxxxxxxxx>
        <mailto:tycho-user@xxxxxxxxxxx <mailto:tycho-user@xxxxxxxxxxx>__>
                 <mailto:tycho-user@xxxxxxxxxxx
        <mailto:tycho-user@xxxxxxxxxxx> <mailto:tycho-user@xxxxxxxxxxx
        <mailto:tycho-user@xxxxxxxxxxx>__>__>
                          To change your delivery options, retrieve your
        password, or
                          unsubscribe from this list, visit
        https://dev.eclipse.org/______mailman/listinfo/tycho-user
        <https://dev.eclipse.org/____mailman/listinfo/tycho-user>

        <https://dev.eclipse.org/____mailman/listinfo/tycho-user
        <https://dev.eclipse.org/__mailman/listinfo/tycho-user>>

          <https://dev.eclipse.org/____mailman/listinfo/tycho-user
        <https://dev.eclipse.org/__mailman/listinfo/tycho-user>
                 <https://dev.eclipse.org/__mailman/listinfo/tycho-user
        <https://dev.eclipse.org/mailman/listinfo/tycho-user>>>

                      _____________________________________________________
                      tycho-user mailing list
        tycho-user@xxxxxxxxxxx <mailto:tycho-user@xxxxxxxxxxx>
        <mailto:tycho-user@xxxxxxxxxxx <mailto:tycho-user@xxxxxxxxxxx>__>
                 <mailto:tycho-user@xxxxxxxxxxx
        <mailto:tycho-user@xxxxxxxxxxx> <mailto:tycho-user@xxxxxxxxxxx
        <mailto:tycho-user@xxxxxxxxxxx>__>__>
                      To change your delivery options, retrieve your
        password, or
                      unsubscribe from this list, visit
        https://dev.eclipse.org/______mailman/listinfo/tycho-user
        <https://dev.eclipse.org/____mailman/listinfo/tycho-user>

        <https://dev.eclipse.org/____mailman/listinfo/tycho-user
        <https://dev.eclipse.org/__mailman/listinfo/tycho-user>>


          <https://dev.eclipse.org/____mailman/listinfo/tycho-user
        <https://dev.eclipse.org/__mailman/listinfo/tycho-user>
                 <https://dev.eclipse.org/__mailman/listinfo/tycho-user
        <https://dev.eclipse.org/mailman/listinfo/tycho-user>>>




                 ___________________________________________________
                 tycho-user mailing list
        tycho-user@xxxxxxxxxxx <mailto:tycho-user@xxxxxxxxxxx>
        <mailto:tycho-user@xxxxxxxxxxx <mailto:tycho-user@xxxxxxxxxxx>__>
                 To change your delivery options, retrieve your password, or
                 unsubscribe from this list, visit
        https://dev.eclipse.org/____mailman/listinfo/tycho-user
        <https://dev.eclipse.org/__mailman/listinfo/tycho-user>
                 <https://dev.eclipse.org/__mailman/listinfo/tycho-user
        <https://dev.eclipse.org/mailman/listinfo/tycho-user>>

             ___________________________________________________
             tycho-user mailing list
        tycho-user@xxxxxxxxxxx <mailto:tycho-user@xxxxxxxxxxx>
        <mailto:tycho-user@xxxxxxxxxxx <mailto:tycho-user@xxxxxxxxxxx>__>
             To change your delivery options, retrieve your password, or
             unsubscribe from this list, visit
        https://dev.eclipse.org/____mailman/listinfo/tycho-user
        <https://dev.eclipse.org/__mailman/listinfo/tycho-user>
             <https://dev.eclipse.org/__mailman/listinfo/tycho-user
        <https://dev.eclipse.org/mailman/listinfo/tycho-user>>




        _________________________________________________
        tycho-user mailing list
        tycho-user@xxxxxxxxxxx <mailto:tycho-user@xxxxxxxxxxx>
        To change your delivery options, retrieve your password, or
        unsubscribe from this list, visit
        https://dev.eclipse.org/__mailman/listinfo/tycho-user
        <https://dev.eclipse.org/mailman/listinfo/tycho-user>

    _________________________________________________
    tycho-user mailing list
    tycho-user@xxxxxxxxxxx <mailto:tycho-user@xxxxxxxxxxx>
    To change your delivery options, retrieve your password, or
    unsubscribe from this list, visit
    https://dev.eclipse.org/__mailman/listinfo/tycho-user
    <https://dev.eclipse.org/mailman/listinfo/tycho-user>




_______________________________________________
tycho-user mailing list
tycho-user@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/tycho-user



Back to the top