【问题标题】:Order Maven Versions Plugin to use specific repositories only订购 Maven 版本插件以仅使用特定的存储库
【发布时间】:2013-02-01 11:20:33
【问题描述】:

也许这太细化了,但我想命令Maven Versions Plugin 只使用特定的存储库来检查(新版本)。这样做的原因是:我希望插件仅检查内部公司依赖项(来自本地 Nexus),我们没有理由检查外部存储库。 (需要一些时间,这在某种程度上也是一个安全问题)。我在父(“配置”)POM 中有以下设置:

<plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>versions-maven-plugin</artifactId>
    <version>2.0</version>
    <configuration>
        <includes>
            <include>com.mycompany.*:*</include>
        </includes>
        <serverId>automation-nexus</serverId>
    </configuration>
</plugin>

上述配置在不更新“外部”依赖项方面工作正常,但仍从所有其他存储库查询“com.mycompany”工件。如您所见,我尝试使用&lt;serverId&gt;,但这只是一个猜测,它似乎没有做任何“过滤”(我猜这只是使用特定凭据的一种方式)

是否可行?

【问题讨论】:

    标签: maven versioning nexus


    【解决方案1】:

    你必须改变你的 settings.xml 而不是像这样的版本插件配置:

    <settings>
      <mirrors>
        <mirror>
          <!--This sends everything else to /public -->
          <id>nexus</id>
          <mirrorOf>*</mirrorOf>
          <url>http://localhost:8081/nexus/content/groups/public</url>
        </mirror>
      </mirrors>
      <profiles>
        <profile>
          <id>nexus</id>
          <!--Enable snapshots for the built in central repo to direct -->
          <!--all requests to nexus via the mirror -->
          <repositories>
            <repository>
              <id>central</id>
              <url>http://central</url>
              <releases><enabled>true</enabled></releases>
              <snapshots><enabled>true</enabled></snapshots>
            </repository>
          </repositories>
         <pluginRepositories>
            <pluginRepository>
              <id>central</id>
              <url>http://central</url>
              <releases><enabled>true</enabled></releases>
              <snapshots><enabled>true</enabled></snapshots>
            </pluginRepository>
          </pluginRepositories>
        </profile>
      </profiles>
      <activeProfiles>
        <!--make the profile active all the time -->
        <activeProfile>nexus</activeProfile>
      </activeProfiles>
    </settings>
    

    通过使用上述设置,您将限制对上述组的访问,此外,您可以在存储库组内搜索,而不是任何外部存储库。

    【讨论】:

    • 感谢您的提示,但在我们当前的环境中,我们有 3 个存储库:我们的内部主要关联(镜像 Maven 存储库)、我们的内部发布关联(仅包含我们自己的库)和 Atlassian 存储库。显然我只想检查第二个存储库。我应该如何修改 settings.xml 来实现这一点?
    • 您不应修改设置。您必须更改 Nexus 中的配置。这就是仅在存储库管理器而不是客户端(settings.xml)中更改存储库顺序的想法。
    • 由于防火墙(安全)限制(以及 AFAIK,Atlassion 的存储库位于 HTTPS 之后),我们的 Nexus 实例无法使用 HTTPS,因此我们必须使用多个配置文件/存储库。所以我们的系统拓扑无法实现我的目标?
    猜你喜欢
    • 2010-11-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-12-20
    • 1970-01-01
    • 1970-01-01
    • 2016-11-21
    • 1970-01-01
    相关资源
    最近更新 更多