2017-01-26 8 views
0

Могу ли я ограничить Maven использовать данный репозиторий (группу) Nexus только для разрешения плагинов и их зависимостей (и не для зависимостей самого проекта)?Разрешить репозиторий только для плагинов?

На данный момент я использую settings.xml, который отражает все, что в «общественной» группы:

<?xml version="1.0" encoding="UTF-8"?> 

<settings> 
    <mirrors> 
     <mirror> 
      <!--This sends everything to /public --> 
      <id>nexus</id> 
      <mirrorOf>*</mirrorOf> 
      <url>http://ik-repo:8080/nexus/content/groups/public</url> 
     </mirror> 
    </mirrors> 
    <profiles> 
     <profile>   
      <id>nexus</id> 
      <repositories> 
       <repository> 
        <id>central</id> 
        <url>http://central</url> 
        <snapshots><enabled>true</enabled></snapshots> 
        <releases><enabled>true</enabled></releases> 
       </repository> 
      </repositories> 
      <pluginRepositories> 
       <pluginRepository> 
        <id>central</id> 
        <url>http://central</url> 
        <snapshots><enabled>true</enabled></snapshots> 
        <releases><enabled>true</enabled></releases> 
       </pluginRepository> 
      </pluginRepositories> 
     </profile> 
    </profiles> 
    <activeProfiles> 
     <!--make the profile active all the time --> 
     <activeProfile>nexus</activeProfile> 
    </activeProfiles> 
</settings> 

Теперь я хотел бы использовать вторую группу «pluginPublic» (в дополнение к «общественности»), что используется для разрешения зависимостей плагинов.

Фон выглядит следующим образом: Я хочу, чтобы определенные зависимости могли использоваться плагинами Maven, но не позволяли каждому разработчику получить к ним доступ для их сборки.

+0

Почему это помечено 'java' ? – Mistalis

+0

Многие плагины maven привязаны к java-экосистеме, например 'cxf-codegen-plugin'. Тег мне кажется уместным. – vikingsteve

ответ

0

Я закончил с использованием зеркала для всего, кроме хранилища плагин группы:

<settings> 
    <mirrors> 
     <mirror> 
      <!--This sends everything to /public --> 
      <id>nexus</id> 
      <mirrorOf>*,!pluginpublic</mirrorOf> 
      <url>http://ik-repo:8080/nexus/content/groups/public</url> 
     </mirror> 
    </mirrors> 
    <profiles> 
     <profile>   
      <id>nexus</id> 
      <repositories> 
       <repository> 
        <id>central</id> 
        <url>http://central</url> 
        <snapshots><enabled>true</enabled></snapshots> 
        <releases><enabled>true</enabled></releases> 
       </repository> 
      </repositories> 
      <pluginRepositories> 
       <pluginRepository> 
        <id>central</id> 
        <url>http://central</url> 
        <snapshots><enabled>true</enabled></snapshots> 
        <releases><enabled>true</enabled></releases> 
       </pluginRepository> 
       <pluginRepository> 
        <id>pluginpublic</id> 
        <url>http://ik-repo:8080/nexus/content/groups/pluginpublic/</url> 
        <snapshots><enabled>true</enabled></snapshots> 
        <releases><enabled>true</enabled></releases> 
       </pluginRepository> 
      </pluginRepositories> 
     </profile> 
    </profiles> 
    <activeProfiles> 
     <!--make the profile active all the time --> 
     <activeProfile>nexus</activeProfile> 
    </activeProfiles> 
</settings> 
1

Да, вы можете просто настроить pluginRepositores в вашем .m2/settings.xml

 <repositories> 
      <repository> 
       <id>central</id> 
       <url>https://my.company/repo</url> 
       <snapshots> 
        <enabled>false</enabled> 
       </snapshots> 
      </repository> 
     </repositories> 

     <pluginRepositories> 
      <pluginRepository> 
       <id>central</id> 
       <url>https://my.company/plugin_repo</url> 
       <snapshots> 
        <enabled>false</enabled> 
       </snapshots> 
      </pluginRepository> 
     </pluginRepositories> 
+0

Что относительно зеркал? Могу ли я определить их отдельно для репозиториев и плагиновRepositories? На данный момент я устанавливаю зеркало, которое отправляет все в публичную группу моего Nexus. Я хотел бы иметь второе зеркало для плагинов. Это возможно? –

+0

Если вы используете 'mirror', не представляется возможным легко разделить артефакты плагинов и непланов в' settings.xml' или 'pom.xml'. Вместо этого вы могли бы сконфигурировать ваш экземпляр nexus с тремя репозиториями: один для зависимостей проекта, один для плагинов (с шаблоном включения для 'org.apache.maven.plugins' и третий (который вы отвлекаете), который прокси-серверы.Но так как я использую artifactory, я не уверен, что это возможно - вам нужно будет проверить его. – vikingsteve

+0

Но если я зеркало от группы, которая проксирует оба, мой Maven все еще может создавать проекты с зависимостями плагина, cann 't it? –