Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [m2e-users] Code completion only for direct dependencies

Maven does not distinguish between direct and indirect dependencies.
Changing this inside m2e will almost certainly break many existing
projects and will introduce unnecessary confusion to the users. It may
also result in unwanted/unexpected interference with maven
"nearest-first" dependency conflict resolution approach, but I can be
wrong here (have not really thought about it, to be honest). I do not
believe this is a good change for m2e.

At the same time, m2e APIs allow customization of Maven Dependencies
classpath, including classpath visibility rules, so you should be able
to implement behaviour you describe in a standalone (eclipse) plugin,
without making changes to m2e.

--
Regards,
Igor

On 12-03-12 7:45 AM, Stefan Rademacher wrote:
Hi,
I know the dependency:analyze goal, which does exactly, what I'd like to
be integrated into m2e: Recognize dependencies, which aren't declared
explicitly.
Igor, which other metadata do you think is needed? Wouldn't it be
sufficient to check, if a dependency is declared directly in the
project's pom?
In a non-maven project, .classpath would look like this:
<classpathentry kind="lib" path="libs/somelib.jar"
sourcepath="libs/somelib.jar">
<accessrules>
<accessrule kind="nonaccessible" pattern="**"/>
</accessrules>
</classpathentry>
Is it possible to define such "nonaccessible" rule for liraries within
"org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER"?
Best regards,
Stefan


 >>> <m2e-users-request@xxxxxxxxxxx> 09.03.2012 18:00 >>>
Date: Thu, 08 Mar 2012 18:40:10 -0500
From: Igor Fedorenko <igor@xxxxxxxxxxxxxx>
To: Maven Integration for Eclipse users mailing list
<m2e-users@xxxxxxxxxxx>,m2e-users@xxxxxxxxxxx
Subject: Re: [m2e-users] Code completion only for direct dependencies
Message-ID: <3644b2f6-8773-4caf-baba-1b7098a0e29c@xxxxxxxxxxxxxxxxx>
Content-Type: text/plain; charset=UTF-8

There is no notion of classpath access rules in Maven, so m2e simply
does not have the metadata needed. Until this is supported in maven
core, there is not much we can do in m2e.
--
Sent from my SGS

Stefan Rademacher <Rademacher@xxxxxxx> wrote:

 >Hi,
 >
 >we are currently moving our complete build management from Ant to
 >Maven. One advantage now is the strong dependency management,
 >especially for transitive dependencies.
 >
 >But within eclipse, there is a big downside, that we didn't see before:
 >The code completion allows every developer to use classes from any
 >transitive dependency, even though it isn't explicitly declared in our
 >pom.
 >An example: An open source library uses Google Guava internally, but we
 >- for some reason - don't want to use it in our code. The "Maven
 >Dependencies" in Eclipse contain Google Guava, because it is needed by
 >that 3rd party library, and is consequently also offered in the Eclipse
 >code completion.
 >
 >Is there a way to tell m2e to restrict the access only to the direct
 >dependencies, declared in our pom.xml? Maybe by generating Eclipse
 >access rules for the "Maven Dependencies" Classpath Container?
 >
 >Thank you very much and best regards
 >Stefan
 >_______________________________________________
 >m2e-users mailing list
 >m2e-users@xxxxxxxxxxx
 >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