문제

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

도움이 되었습니까?

해결책

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>

다른 팁

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>
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top