kingledion
kingledion

Reputation: 2500

In Maven, what is the difference between `package:artifact:jar:version` and package:artifact:jar:tests:version`?

Using Maven 3.0.5

I'm trying to get spark-testing-base from com.holdenkarau to work with Hadoop 3.1. holdenkarau's dependency tree includes Hadoop 2.8.3; which is why I think I'm getting errors.

From my mvn dependency:tree I see the following lines:

[INFO] +- org.apache.hadoop:hadoop-common:jar:3.1.0:provided

...

[INFO] |  +- org.apache.hadoop:hadoop-common:jar:tests:2.8.3:test

These lines come from these two lines in the pom.xml file:

    <dependency>
        <groupId>org.apache.hadoop</groupId>
        <artifactId>hadoop-common</artifactId>
        <version>3.1.0</version>
        <scope>provided</scope>
    </dependency>

    <dependency>
        <groupId>com.holdenkarau</groupId>
        <artifactId>spark-testing-base_${scala.compat.version}</artifactId>
        <version>${spark.version}_0.12.0</version>
        <scope>test</scope>
        <exclusions>
            <exclusion>
                <groupId>commons-beanutils</groupId>
                <artifactId>commons-beanutils-core</artifactId>
            </exclusion>
        </exclusions>
    </dependency>

I basically have two related questions:

Upvotes: 0

Views: 87

Answers (1)

OneCricketeer
OneCricketeer

Reputation: 191738

tests is called a classifier, and it contains code that's really only useful in the context of actually testing, such as an embedded HDFS system

You could explicitly try pulling in a new version like so, assuming it exists

<dependency>
    <groupId>org.apache.hadoop</groupId>
    <artifactId>hadoop-common</artifactId>
    <version>3.1.0</version>
    <scope>test</scope>
     <classifier>test</classifier>
</dependency>

You may also want to exclude the same within the other dependency, however you might then run into build issues since that library is only written to test against 2.8.3

Upvotes: 1

Related Questions