Aksel Willgert
Aksel Willgert

Reputation: 11547

How can I see which POm dependency entry is adding a certain jar to eclipse classpath

Is it possible using the m2e maven plugin for eclipse (or some other easy way), to figure out which <dependency> entry in my POM is the reason for a given .jar to be added to the classpath. afaik right click only allows me to see the pom of the given artifact.

Eclipse example

in this example the my pom looks like

<dependencies>
    <dependency>
        <groupId>eu.medsea.mimeutil</groupId>
        <artifactId>mime-util</artifactId>
        <version>2.1.1</version>
    </dependency>
</dependencies>

so it's pretty easy to understand that who is responsible for adding the log4j things

Upvotes: 0

Views: 90

Answers (2)

artbristol
artbristol

Reputation: 32427

Open the POM in the m2e POM editor (should happen by default), click Dependency Hierarchy, type the name of the offending dependency into the filter box. It will highlight the dependency that drags it in.

Upvotes: 1

Aksel Willgert
Aksel Willgert

Reputation: 11547

Oh well figured it .. right click->maven->exclude maven artifact would place a nice exclusion element on the dependency causing the inclusion

<dependencies>
    <dependency>
        <groupId>eu.medsea.mimeutil</groupId>
        <artifactId>mime-util</artifactId>
        <version>2.1.1</version>
        <exclusions>
            <exclusion>
                <artifactId>slf4j-api</artifactId>
                <groupId>org.slf4j</groupId>
            </exclusion>
        </exclusions>
    </dependency>
</dependencies>

Upvotes: 0

Related Questions