简体   繁体   English

多个存储库中存在快照依赖项

[英]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? 有没有办法可以强制Maven / Tycho更喜欢特定存储库中的快照?

EDIT : They are P2 plugin repositories created for Eclipse PDE Build 编辑:它们是为Eclipse PDE Build创建的P2插件存储库

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. 列表中的XML元素与Maven一起基于FIFO。 So, if you define your repository at hte very top (before the other ones), Maven should end up resolving it from there. 因此,如果您在hte非常顶部(在其他之前)定义您的存储库,Maven应该最终从那里解析它。

If you're using an artifact repository manager, you could define routing rules. 如果您正在使用工件存储库管理器,则可以定义路由规则。

我想你可以创建一个配置文件并添加你想要的存储库作为唯一的存储库。

You could exclude all transitive snapshot deps and add the dependency explicitly: 您可以排除所有可传递的快照deps并显式添加依赖项:

<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 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM