开发者

how to make the maven to use Internal Repository instead of using central Maven repository?

I have configured parent pom.xml to use the internal repository which i have created it with apache Archiva. My Pom looks like

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

I am trying to execute the same from the Hudson. But when it tries to download any missing plugin it still tries to down开发者_Python百科load from central repo1.maven.org. For your information i have all the plugins configured in my internal repo.


I use the following configuration in .m2/settings.xml to forward all request to an internal repository:

<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>

Btw, I've used Archiva in the past and I can recommend you to try out Sonatype Nexus or Artifactory - they are both free and both much nicer than Archiva.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜