как заставить maven использовать внутренний репозиторий вместо использования центрального репозитория Maven? - PullRequest
4 голосов
/ 20 августа 2010

Я настроил родительский pom.xml для использования внутреннего репозитория, который я создал с помощью Apache Archiva. Мой пом выглядит как

<distributionManagement>
  <repository>
    <id>internal</id>
    <url>dav:http://x.x.x.x:9090/archiva/repository/internal</url>
  </repository>
</distributionManagement>

Я пытаюсь выполнить то же самое из Гудзона. Но когда он пытается загрузить любой отсутствующий плагин, он все равно пытается загрузить его с центрального repo1.maven.org. Для вашей информации у меня есть все плагины, настроенные в моем внутреннем репо.

1 Ответ

2 голосов
/ 20 августа 2010

Я использую следующую конфигурацию в .m2 / settings.xml для пересылки всех запросов во внутренний репозиторий:

<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
                              http://maven.apache.org/xsd/settings-1.0.0.xsd">

  <localRepository>/home/bozhidar/.m2/repository</localRepository>
  <interactiveMode>true</interactiveMode>
  <offline>false</offline>

  <servers> 
    <server> 
      <id>nexus</id> 
      <username>***</username> 
      <password>***</password> 
    </server> 
  </servers> 

  <mirrors>
    <mirror>
      <!--This sends everything else to /public -->
      <id>nexus</id>
      <mirrorOf>*</mirrorOf>
      <url>https://xxx/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>

Кстати, я использовал Archiva в прошлом, и я могу порекомендовать вам попробовать Sonatype Nexus или Artifactory - они оба бесплатны и намного приятнее, чем Archiva.

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...