Question

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

Was it helpful?

Solution

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>

OTHER TIPS

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.

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

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>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top