如何为Maven设置Archiva内部+快照存储库? [英] How to setup Archiva internal+snapshot repository for Maven?

查看:90
本文介绍了如何为Maven设置Archiva内部+快照存储库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们正在尝试将Archiva用作中央和其他外部存储库的Maven代理,以及用作我们的工件的快照存储,这些工件由Hudson从SVN自动构建并安装到快照存储库中.

We are trying to use Archiva as a Maven proxy for central and other external repositories and also as a snapshot storage for our artifacts which are automatically built by Hudson from SVN and installed to the snapshot repository.

我无法设置Maven客户端同时使用内部存储库和快照存储库.我的项目具有一些外部依赖项(例如log4j),这些依赖项可以从Archiva内部存储库中正确下载.另外,我的项目还依赖于自己的项目,该项目的工件已经构建并安装到快照存储库中.但是,如果我尝试构建项目,Maven将找不到我的快照工件.

I can't setup my Maven client to use the internal and snapshots repositories together. My project has some external dependencies (like log4j) which are downloaded from the Archiva internal repository correctly. Also my project has a dependency to an own project which's artifact is already built and installed to the snapshot repository. However if i try to build the project Maven can't find my snapshot artifact.

我的配置文件最初具有以下设置:

My configuration file had originally this setting:

<mirror>
  <id>company-internal</id>
  <name>Company's Archiva - Internal Repository</name>
  <url>http://www.mycompany.hu/archiva/repository/internal</url>
  <mirrorOf>*</mirrorOf>
</mirror>

然后我添加了以下内容:

and then i added the following:

<mirror>
 <id>company-snapshots</id>
 <name>Company Archiva - Snapshots Repository</name>
 <url>http://www.mycompany.hu/archiva/repository/snapshots</url>
 <mirrorOf>apache.snapshots</mirrorOf>
</mirror>

但是,Maven不会在构建时尝试查找snaphot存储库. 我做错什么了?顺便说一句,我并没有真正达到<mirrorOf>元素的目的.我尝试将内部镜像设置替换为central,但这仍然不能解决我的问题.

However Maven doesn't tries to look up the snaphot repository at build. What did i do wrong? By the way i don't really get the <mirrorOf> elements purpose. I've tried to replace this at internal mirror settings to central but this still doesn't fix my problem.

推荐答案

在经过反复试验后,以下配置对我有用.在这里,我使用默认的archiva配置-internal保存版本,snapshots仅保存内部快照.

The following configuration worked for me after some trial and error. Here I used the default archiva configuration - internal to hold releases and snapshots to hold only the internal snapshots.

nexus 基本上不同,我们需要两个单独的<mirror><repository>声明-一个用于正常工件另一个用于快照工件.

Essentially unlike nexus we need two separate <mirror> and <repository> declarations - one for the normal artifacts and the other for snapshot artifacts.

<mirrors>
    <mirror>
        <id>archiva</id>
        <mirrorOf>*</mirrorOf>
        <url>http://localhost:8080/archiva/repository/internal</url>
    </mirror>
    <mirror>
        <id>snapshots</id>
        <mirrorOf>snapshots</mirrorOf>
        <url>http://localhost:8080/archiva/repository/snapshots</url>
    </mirror>
</mirrors>
<profiles>
    <profile>
        <activation>
            <activeByDefault>true</activeByDefault>
        </activation>
        <repositories>
            <repository>
              <id>internal</id>
              <name>Archiva Managed Internal Repository</name>
              <url>http://localhost:8080/archiva/repository/internal/</url>
              <releases>
                <enabled>true</enabled>
              </releases>
              <snapshots>
                <enabled>false</enabled>
              </snapshots>
            </repository>
            <repository>
              <id>snapshots</id>
              <name>Archiva Managed Internal Repository</name>
              <url>http://localhost:8080/archiva/repository/snapshots/</url>
              <releases>
                <enabled>false</enabled>
              </releases>
              <snapshots>
                <enabled>true</enabled>
              </snapshots>
            </repository>
        </repositories>
    </profile>
</profiles>

这篇关于如何为Maven设置Archiva内部+快照存储库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆