Telebh
Telebh

Reputation: 345

How to stop Maven from downloading all historical versions of aws-java-sdk?

I am using Maven to download aws-java-sdk dependency for version 1.11.23, though in Maven repository I find all historical versions till most recent ones; i.e. aws-java-sdk-sqs downloaded versions (1.9.0 to 1.11.642) any idea why is that and how can I limit to only the version specified for aws-java-sdk artifact?

Upvotes: 6

Views: 1149

Answers (3)

Velu
Velu

Reputation: 1911

For me, After specifying the BOM of AWS SDK in the dependencyManagement section & the version I would like to use, The historical downloads were stopped. Below are my dependencies.

<dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>com.amazonaws</groupId>
            <artifactId>aws-java-sdk-bom</artifactId>
            <version>1.10.6</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency>
    </dependencies>
</dependencyManagement>
<dependencies>
    <dependency>
        <groupId>com.amazonaws</groupId>
        <artifactId>aws-java-sdk-s3</artifactId>
    </dependency>
    <dependency>
        <groupId>com.amazonaws</groupId>
        <artifactId>aws-java-sdk-dynamodb</artifactId>
    </dependency>
    <dependency>
        <groupId>com.amazonaws</groupId>
        <artifactId>aws-lambda-java-core</artifactId>
        <version>1.0.0</version>
    </dependency>
    <dependency>
        <groupId>com.amazonaws</groupId>
        <artifactId>aws-lambda-java-events</artifactId>
        <version>1.0.0</version>
    </dependency>
</dependencies>

Upvotes: 2

Alex R
Alex R

Reputation: 11891

This "dependency loop" is a problem with some older versions of aws-lambda-java-events, which is probably a dependency of your dependency.

Try updating or your dependencies to the latest, or overriding aws-lambda-java-events to at least 2.2.7:

    <dependency>
        <groupId>com.amazonaws</groupId>
        <artifactId>aws-lambda-java-events</artifactId>
        <version>2.2.7</version>
    </dependency>

Upvotes: 3

Gerold Broser
Gerold Broser

Reputation: 14772

I created a project (with Maven 3.5.4) with just:

<project ... >
    ....
    <dependencies>
        <dependency>
            <groupId>com.amazonaws</groupId>
            <artifactId>aws-java-sdk</artifactId>
            <version>1.11.23</version>
        </dependency>
    </dependencies>
</project>

All of ~/.m2/repository/com/amazonaws/* (as declared in aws-java-sdks POM) contain just the sub-directory /1.11.23.

UPDATE

To exclude dependencies of your dependencies see Introduction to the Dependency Mechanism, Transitive Dependencies:

  • Excluded dependencies - If project X depends on project Y, and project Y depends on project Z, the owner of project X can explicitly exclude project Z as a dependency, using the "exclusion" element.

Upvotes: -2

Related Questions