8

The following is the error I see, what confused me is that why it would depends on 2 versions of my-engine dependency. One is 0.9.0-20180510.015454-2 and another is 0.9.0-SNAPSHOT.

Heres's the command I use:

mvn clean install -DskipTests

In the pom.xml, I specify the version as ${project.version} which here should be 0.9.0-SNAPSHOT. Could you anyone help me ? Thanks

[INFO] --- maven-enforcer-plugin:1.3.1:enforce (enforce) @ zeppelin-server ---
[WARNING]
Dependency convergence error for org.apache.hadoop:hadoop-client:2.7.3 paths to dependency are:
+-myproject:my-server:0.9.0-SNAPSHOT
  +-myproject:my-engine:0.9.0-20180510.015454-2
    +-org.apache.hadoop:hadoop-client:2.7.3
and
+-myproject:my-server:0.9.0-SNAPSHOT
  +-myproject:my-engine:0.9.0-SNAPSHOT
    +-org.apache.hadoop:hadoop-client:2.7.5

Here's the dependency in pom.xml

  <dependency>
    <groupId>myproject</groupId>
    <artifactId>my-zengine</artifactId>
    <version>${project.version}</version>
    <classifier>tests</classifier>
    <scope>test</scope>
  </dependency>

<dependency>
  <groupId>${project.groupId}</groupId>
  <artifactId>my-zengine</artifactId>
  <version>${project.version}</version>
</dependency>
zjffdu
  • 25,496
  • 45
  • 109
  • 159
  • The problem is based on the different version `org.apache.hadoop:hadoop-client:2.7.3` and `org.apache.hadoop:hadoop-client:2.7.5` furthermore I would like to see the pom files... – khmarbaise Jul 28 '18 at 09:59
  • I know, but as you can see hadoop 2.7.3 is a dependency of my-engine:0.9.0-20180510.015454-2 while hadoop 2.7.5 is a dependency of myproject:my-engine:0.9.0-SNAPSHOT, I am just confused why there's 2 different dependency of my-engine – zjffdu Jul 29 '18 at 03:03
  • @zjffdu `0.9.0-20180510.015454-2` looks like a SNAPSHOT [unique version](https://maven.apache.org/plugins/maven-deploy-plugin/deploy-file-mojo.html#uniqueVersion) deployed on a repository manager or locally, so maybe the confusion comes from here. Can you provide your pom files or a minimal example to reproduce the issue? Have you multiple dependencies to `myproject:my-server` in your project? Do you use a repository manager? – norbjd Jul 29 '18 at 07:44
  • @zjffdu Check what norbjd said... – khmarbaise Jul 29 '18 at 08:50
  • Update the post, adding dependencies of pom.xml – zjffdu Jul 31 '18 at 06:29
  • I think I found the root cause. It is because I use `mvn clean package -DskipTests` to build it, so the tests scoped dependency is not built locally, that's why maven will looking for the timestamp version. So is there any way to fix it ? – zjffdu Jul 31 '18 at 06:46

1 Answers1

2

You could fix this in one of two ways, either choose to ignore it

mvn clean install -Denforcer.fail=false

or add both wildcard exclusion and exclusion for every dependency that caused the enforcer in the first place as follows.

<dependency>
<groupId>org.apache.maven.plugin-tools</groupId>
<artifactId>maven-plugin-tools-api</artifactId>
<version>2.5.1</version>
<exclusions>
    <exclusion>
        <groupId>*</groupId>
        <artifactId>*</artifactId>
    </exclusion>
    <exclusion>
        <groupId>org.apache.hadoop</groupId>
        <artifactId>hadoop-client</artifactId>
    </exclusion>
</exclusions>

Amos Kosgei
  • 877
  • 8
  • 14