elkoo
elkoo

Reputation: 762

How to exclude a dependency from remote mavenpom?

I have a local pom which uses mahout-0.8 dependency. Mahout pom includes hadoop-core dependency with 1.1.2 version. Link to mahout-0.8 pom

But in my project I need the latest hadoop-core, which is 2.2.0 version. As I have read hadoop-core-2.2.0 is built from these dependencies:

        <dependency>
            <groupId>org.apache.hadoop</groupId>
            <artifactId>hadoop-common</artifactId>
            <version>2.2.0</version>
        </dependency>
        <dependency>
            <groupId>org.apache.hadoop</groupId>
            <artifactId>hadoop-mapreduce-client-core</artifactId>
            <version>2.2.0</version>
        </dependency>

So I need to exclude dependency from remote mahout-0.8 dependency. How to exclude this dependency (snipped) or it cannot be done remotely?

<dependency>
    <groupId>org.apache.hadoop</groupId>
    <artifactId>hadoop-core</artifactId>
    <version>${hadoop.version}</version>
    ...
</dependency>

If it cannot be done in such way, would like to know how to integrate mahout pom to my local project. Many thanks!

Upvotes: 0

Views: 1199

Answers (1)

stripybadger
stripybadger

Reputation: 5019

Copy the hadoop-core dependency in your second snippet into the dependencyManagement section of your pom. This will manage it to whatever version you specify.

Or, if you really really want to stop it from coming from mahout all together, change your mahout dependency to something like the following:

<dependency>
    <groupId>org.apache.mahout</groupId>
    <artifactId>mahout</artifactId>
    <version>0.8</version>
    <exclusions>
       <exclusion>
           <groupId>org.apache.hadoop</groupId>
           <artifactId>hadoop-core</artifactId>
       </exclusion>
    </exclusions>
</dependency>

Upvotes: 1

Related Questions