Pushkar
Pushkar

Reputation: 7580

Snapshot dependency present in multiple repositories

I am facing a unique issue -

I have a plugin dependency which is present in multiple repositories. The version number is same just the snapshot qualifier( time-stamp is different ).

Is there a way I can force Maven/Tycho to prefer the snapshot from a particular repository?

EDIT : They are P2 plugin repositories created for Eclipse PDE Build

Upvotes: 0

Views: 93

Answers (4)

carlspring
carlspring

Reputation: 32627

XML elements in lists are on a FIFO basis with Maven. So, if you define your repository at hte very top (before the other ones), Maven should end up resolving it from there.

If you're using an artifact repository manager, you could define routing rules.

Upvotes: 1

oberlies
oberlies

Reputation: 11723

You can specify a filter on the target platform to remove all but one version:

<plugin>
   <groupId>org.eclipse.tycho</groupId>
   <artifactId>target-platform-configuration</artifactId>
   <version>${tycho-version}</version>
   <configuration>
      <filters>
         <filter>
            <type>eclipse-plugin</type>
            <id>id.of.dependency</id>
            <restrictTo>
               <version>1.2.3.2014020241355</version>
            </restrictTo>
         </filter>
      </filters>
   </configuration>
<plugin>

Upvotes: 1

Yser
Yser

Reputation: 2106

You could exclude all transitive snapshot deps and add the dependency explicitly:

<dependency>
    <groupId>com.sun.something</groupId>
    <artifactId>something</artifactId>
    <version>version</version>
    <exclusions>
        <exclusion>
            <artifactId>transitive</artifactId>
            <groupId>com.sun.somethingelse</groupId>
        </exclusion>
    </exclusions>
</dependency>
    <dependency>
    <groupId>com.sun.somethingelse</groupId>
    <artifactId>transitive</artifactId>
    <version>version</version>
</dependency>

Upvotes: 0

SebastianH
SebastianH

Reputation: 2182

I guess you could create a profile and add the repository you want as the only repository.

Upvotes: 0

Related Questions