How do i tell Maven to download all versions of a pom.xml instead of a single version?

417 Views Asked by At

I have a master pom.xml with various snapshots and lot of versions. When building the pom.xml , we see only a single version getting downloaded in the m2/localrepo, where as we want to download all versions of a snapshot. On running mvn clean install, we are getting warnings as "dependencies.dependency.(groupId:artifactId:type:classifier)' must be unique" Please check the below xml for the artifactId 'dtc-api-commons' i have a lot of versions which i need to download in my local m2 repository.

**XML:**    
<dependency>
      <groupId>com.dtd</groupId>
      <artifactId>dtc-api-commons</artifactId>
      <version>3.3.2-SNAPSHOT</version>
</dependency>
<dependency>
      <groupId>com.dtd</groupId>
      <artifactId>dtc-api-commons</artifactId>
      <version>3.3.1_1-SNAPSHOT</version>
</dependency>
<dependency>
      <groupId>com.dtd</groupId>
      <artifactId>dtc-api-commons</artifactId>
      <version>3.3.1-SNAPSHOT</version>
</dependency>
<dependency>
      <groupId>com.dtd</groupId>
      <artifactId>dtc-api-commons</artifactId>
      <version>3.3.0-SNAPSHOT</version>
</dependency>

**COmmand:**    
mvn clean install
**Expected Output:**      
 3.3.0-SNAPSHOT 3.3.1.SNAPSHOT 3.3.1_1-SNAPSHOT 3.3.2-SNAPSHOT
**Actual Output**        
3.3.2-SNAPSHOT
Error:
[WARNING] Some problems were encountered while building the effective model for com.dtd:dummy-built:jar:0.0.0-SNAPSHOT
[WARNING] 'dependencies.dependency.(groupId:artifactId:type:classifier)' must be unique: com.dtd:dtc-api-commons:jar -> version 3.3.2-SNAPSHOT vs 3.3.1-SNAPSHOT @ line 15, column 13
[WARNING] 'dependencies.dependency.(groupId:artifactId:type:classifier)' must be unique: com.dtd:dtc-api-commons:jar -> version 3.3.2-SNAPSHOT vs 3.3.0-SNAPSHOT @ line 15, column 13

Please help in downloading all versions of a artifact using the correct maven command.

1

There are 1 best solutions below

0
On

You can't because Maven has the concept of dependency resolution where the nearest wins. Probably the easiest solution is to write a shell/batch script calling dependency:get for every version. But maybe I should ask another important question:

Why?