Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [m2e-users] Eclipse launcher classpath and Maven dependencies

There is much more to Maven dependency resolution than
groupId/artifactId/version. In order to properly resolve dependencies,
m2e needs to know dependency scope, what profiles should be enabled, if
any excludes or dependency management should be applied and probably few
more things I can't immediately remember. I believe m2e already provides
necessary APIs for you to implement your own launch configuration to
support your usecase (which I am still not convinced is legitimate,
btw), but I do not believe it is useful/desirable for majority of m2e users.

--
Regards,
Igor

On 2013-02-15 3:41 PM, Nathaniel Mishkin wrote:
Yes, perhaps, but I actually don't want to declare the dependency in the
POM and since I'm never actually running any of the classes from Maven I
shouldn't have to.  There's a long story around this, but to simplify, I
have multiple projects that constitute my "product".  The creation of
the product's "kit" collects all the jar files together and the script
that launches the product puts all the jar files on the classpath, to
satisfy the runtime dependency requirement.

Let me first focus on the behavior of an Eclipse launcher and its
classpath properties when neither Maven nor m2e are involved.  One can
add an arbitrary Eclipse project to any launcher's classpath.  When one
does this, one has the option to "Add required projects of selected
projects" (as the UI puts it).  E.g., suppose Eclipse Project X depends
on Eclipse Project Y.  When I add Project X to the launcher one gets to
say whether or not Project Y should be added to the classpath as well.
  I assume that the launcher's classpath implicitly also acquires the
projects' library dependencies.

Now let's add Maven/m2e to the story:  By analogy with the non-Maven/m2e
scenario, I think it'd be sensible if when one adds an Eclipse project
that has the Maven nature to a launcher's classpath that the Maven
dependencies of that project also (implicitly) get added to the
launcher's classpath.  Of course, I have no idea whether the
architecture of launchers allows for this (i.e., allows for m2e to have
this "contribute to classpath" feature).  That's really what I'm asking
about though.

Nat



On Fri, Feb 15, 2013 at 1:07 PM, Igor Fedorenko <igor@xxxxxxxxxxxxxx
<mailto:igor@xxxxxxxxxxxxxx>> wrote:

    I think dependency scope=runtime is what you want. It tell the tooling,
    i.e. Maven or m2e, about this runtime dependency so tooling has the
    chance to do the right thing for you.

    --
    Regards,
    Igor


    On 2013-02-15 11:54 AM, Nathaniel Mishkin wrote:

        Here's my situation:

        Project A depends on Project B at runtime only.  Project A's POM
        doesn't
        declare a dependency on Project B.  Since Project A will never be
        launched or packaged in final form from Maven, I think this is
        reasonable.  However, I want to debug Project A (and B) from
        Eclipse so
        I created a launcher for Project A and extended the launcher's
        classpath
        to have a reference to Project B.  What I'd _like_ to happen is that
        Project B's Maven dependencies are also added to the classpath,
        but this
        doesn't seem to happen.  Is there some way to make this happen?
          If not,
        should there be?

        Thanks.

        Nat



        _________________________________________________
        m2e-users mailing list
        m2e-users@xxxxxxxxxxx <mailto:m2e-users@xxxxxxxxxxx>
        https://dev.eclipse.org/__mailman/listinfo/m2e-users
        <https://dev.eclipse.org/mailman/listinfo/m2e-users>

    _________________________________________________
    m2e-users mailing list
    m2e-users@xxxxxxxxxxx <mailto:m2e-users@xxxxxxxxxxx>
    https://dev.eclipse.org/__mailman/listinfo/m2e-users
    <https://dev.eclipse.org/mailman/listinfo/m2e-users>




_______________________________________________
m2e-users mailing list
m2e-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/m2e-users



Back to the top