0

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

Pushkar
  • 7,450
  • 10
  • 38
  • 57

4 Answers4

1

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>
oberlies
  • 11,503
  • 4
  • 63
  • 110
1

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.

carlspring
  • 31,231
  • 29
  • 115
  • 197
0

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

SebastianH
  • 2,172
  • 1
  • 18
  • 29
0

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>
Yser
  • 2,086
  • 22
  • 28
  • it is not a transitive dependency . it is just present in two repositories that I need. I just need to tell maven to prefer one repository over another. – Pushkar Feb 24 '14 at 12:34
  • ah okay...misunderstanding ;) As SebastianH pointed out you could create a profile. Also you can create a parent-pom where you define the repository. Also you could define the plugin there but that you should just do if every module inheriting from the parent should use this plugin. – Yser Feb 24 '14 at 12:41