无法将外部jar下载到Artifactory中

时间:2012-01-09 17:23:55

标签: maven maven-2 repository artifactory

我正在使用Jfrog的Artifactory,并且我已将repo1.maven.org/maven2作为远程存储库包含在内但当我从IDE请求特定工件时,工件不会从远程服务器下载到缓存中吗?知道我在这里缺少什么吗?

编辑:

artifactory.log显示以下错误消息

2012-01-09 13:08:10,814 [pool-1-thread-15] [INFO ] (o.a.c.h.HttpMethodDirector:445) - Retrying request

2012-01-09 13:08:11,814 [pool-1-thread-15] [WARN ] (o.a.r.RemoteRepoBase:323) - jfrog-libs: Error in getting information for 'opensymphony/quartz/1.6.5/quartz-1.6.5.pom' (Failed retrieving resource from http://repo.jfrog.org/artifactory/libs-release-local/opensymphony/quartz/1.6.5/quartz-1.6.5.pom: Connection refused: connect).

2012-01-09 13:08:13,408 [pool-1-thread-16] [INFO ] (o.a.c.h.HttpMethodDirector:439) - I/O exception (java.net.ConnectException) caught when processing request: Connection refused: connect
下面的

是项目的pom.xml

的一部分
<distributionManagement>
        <repository>
            <id>COMPANY_INTERNAL</id>
            <name>COMPANY internal repository</name>
            <url>http://artifactoryserver:18081/artifactory/company</url>
        </repository>
        <snapshotRepository>
            <id>COMPANY_INTERNAL_SNAPSHOTS</id>
            <name>companyinternal snapshot repository</name>
            <url>http://artifactoryserver:18081/artifactory/company</url>
        </snapshotRepository>
    </distributionManagement>

    <repositories>
        <repository>
            <id>COMPANY_PUBLIC</id>
            <name>COMPANY internal and external repository</name>
            <url>http://artifactoryserver:18081/artifactory/repo</url>
            <snapshots>
                <enabled>true</enabled>
                <updatePolicy>always</updatePolicy>
            </snapshots>
        </repository>
    </repositories>

    <pluginRepositories>
        <pluginRepository>
            <id>COMPANY_PLUGINS</id>
            <name>Maven Plugin Repository</name>
            <url>http://artifactoryserver:18081/artifactory/plugins-releases</url>
            <layout>default</layout>
        </pluginRepository>
    </pluginRepositories>

截图

1)Local Repository 2)Remote Repository 3)Virtual Repository 4)Repository Browser

还包括下面的request.log内容,

20120110094113|3735|REQUEST|SERVER_IP_HIDDEN|non_authenticated_user|GET|/repo/com/vividsolutions/jts/1.12-SNAPSHOT/maven-metadata.xml|HTTP/1.1|200|311
20120110094114|63|REQUEST|SERVER_IP_HIDDEN|non_authenticated_user|GET|/repo/com/vividsolutions/jts/1.12-SNAPSHOT/maven-metadata.xml.sha1|HTTP/1.1|200|40
20120110094114|16|REQUEST|SERVER_IP_HIDDEN|non_authenticated_user|GET|/repo/com/vividsolutions/jts/1.12-SNAPSHOT/jts-1.12-SNAPSHOT.pom|HTTP/1.1|304|461
20120110094116|2422|REQUEST|SERVER_IP_HIDDEN|non_authenticated_user|GET|/repo/org/hibernatespatial/hibernate-spatial/1.0-SNAPSHOT/maven-metadata.xml|HTTP/1.1|200|326
20120110094116|16|REQUEST|SERVER_IP_HIDDEN|non_authenticated_user|GET|/repo/org/hibernatespatial/hibernate-spatial/1.0-SNAPSHOT/maven-metadata.xml.sha1|HTTP/1.1|200|40
20120110094116|0|REQUEST|SERVER_IP_HIDDEN|non_authenticated_user|GET|/repo/org/hibernatespatial/hibernate-spatial/1.0-SNAPSHOT/hibernate-spatial-1.0-SNAPSHOT.pom|HTTP/1.1|304|1761
20120110094117|0|REQUEST|SERVER_IP_HIDDEN|admin|GET|/webapp/systemlogs.html|HTTP/1.1|200|0
20120110094118|2406|REQUEST|SERVER_IP_HIDDEN|non_authenticated_user|GET|/repo/org/hibernatespatial/hibernate-spatial-maven/1.0-SNAPSHOT/maven-metadata.xml|HTTP/1.1|200|332
20120110094118|15|REQUEST|SERVER_IP_HIDDEN|non_authenticated_user|GET|/repo/org/hibernatespatial/hibernate-spatial-maven/1.0-SNAPSHOT/maven-metadata.xml.sha1|HTTP/1.1|200|40
20120110094119|16|REQUEST|SERVER_IP_HIDDEN|non_authenticated_user|GET|/repo/org/hibernatespatial/hibernate-spatial-maven/1.0-SNAPSHOT/hibernate-spatial-maven-1.0-SNAPSHOT.pom|HTTP/1.1|304|8144
20120110094121|2281|REQUEST|SERVER_IP_HIDDEN|non_authenticated_user|GET|/repo/company/companylib_service_hibernate/5.0.0-SNAPSHOT/maven-metadata.xml|HTTP/1.1|200|317 
20120110094121|16|REQUEST|SERVER_IP_HIDDEN|non_authenticated_user|GET|/repo/company/companylib_service_hibernate/5.0.0-SNAPSHOT/maven-metadata.xml.sha1|HTTP/1.1|200|40
20120110094121|0|REQUEST|SERVER_IP_HIDDEN|non_authenticated_user|GET|/repo/company/companylib_service_hibernate/5.0.0-SNAPSHOT/companylib_service_hibernate-5.0.0-SNAPSHOT.pom|HTTP/1.1|304|4224
20120110094123|2297|REQUEST|SERVER_IP_HIDDEN|non_authenticated_user|GET|/repo/company/companylib_domain_parent/5.0.0-SNAPSHOT/maven-metadata.xml|HTTP/1.1|200|313
20120110094123|16|REQUEST|SERVER_IP_HIDDEN|non_authenticated_user|GET|/repo/company/companylib_domain_parent/5.0.0-SNAPSHOT/maven-metadata.xml.sha1|HTTP/1.1|200|40
20120110094123|0|REQUEST|SERVER_IP_HIDDEN|non_authenticated_user|GET|/repo/company/companylib_domain_parent/5.0.0-SNAPSHOT/companylib_domain_parent-5.0.0-SNAPSHOT.pom|HTTP/1.1|304|13997
20120110094126|2406|REQUEST|SERVER_IP_HIDDEN|non_authenticated_user|GET|/repo/org/hibernatespatial/hibernate-spatial-oracle/1.0-SNAPSHOT/maven-metadata.xml|HTTP/1.1|200|333
20120110094126|16|REQUEST|SERVER_IP_HIDDEN|non_authenticated_user|GET|/repo/org/hibernatespatial/hibernate-spatial-oracle/1.0-SNAPSHOT/maven-metadata.xml.sha1|HTTP/1.1|200|40
20120110094126|0|REQUEST|SERVER_IP_HIDDEN|non_authenticated_user|GET|/repo/org/hibernatespatial/hibernate-spatial-oracle/1.0-SNAPSHOT/hibernate-spatial-oracle-1.0-SNAPSHOT.pom|HTTP/1.1|304|1779
20120110094127|15|REQUEST|SERVER_IP_HIDDEN|non_authenticated_user|GET|/repo/org/hibernatespatial/hibernate-spatial/1.0-SNAPSHOT/hibernate-spatial-1.0-SNAPSHOT.jar|HTTP/1.1|304|77589
20120110094127|16|REQUEST|SERVER_IP_HIDDEN|non_authenticated_user|GET|/repo/com/vividsolutions/jts/1.12-SNAPSHOT/jts-1.12-SNAPSHOT.jar|HTTP/1.1|304|755797
20120110094127|0|REQUEST|SERVER_IP_HIDDEN|non_authenticated_user|GET|/repo/company/companylib_service_hibernate/5.0.0-SNAPSHOT/companylib_service_hibernate-5.0.0-SNAPSHOT.jar|HTTP/1.1|304|77835
20120110094127|15|REQUEST|SERVER_IP_HIDDEN|non_authenticated_user|GET|/repo/org/hibernatespatial/hibernate-spatial-oracle/1.0-SNAPSHOT/hibernate-spatial-oracle-1.0-SNAPSHOT.jar|HTTP/1.1|304|62943
20120110094127|15|REQUEST|SERVER_IP_HIDDEN|admin|GET|/webapp/systemlogs.html|HTTP/1.1|200|0
20120110094137|0|REQUEST|SERVER_IP_HIDDEN|admin|GET|/webapp/systemlogs.html|HTTP/1.1|200|0

3 个答案:

答案 0 :(得分:4)

我在response.log中看到,您附加了Artifactory为请求的快照工件返回HTTP 304 (Not Modified)响应状态(条目右侧的第二列)。

这意味着所请求的工件已存在于本地计算机的缓存中,并且在Artifactory中找不到更新的版本。

您使用的任何工具都会根据本地版本的上次修改时间(即"Last-Modified""If-Modified-Since")使用条件标头请求此工件;因为没有找到更新的版本,重新下载相同的工件是没有意义的,这就是为什么你没有在Artifactory的缓存仓库中看到它。

答案 1 :(得分:2)

贵公司的网络是否要求您使用代理来访问外部互联网?如果是这样,您需要在Artifactory的Admin / Configuration / Proxies屏幕中设置该代理,然后对于每个外部仓库Artifactory充当代理,您需要在repo的“高级设置”选项卡上指定此代理。

答案 2 :(得分:0)

今天我遇到了同样类型的错误,但是它只是在GET请求上(没有像原始海报一样的DEPLOY)。

在我的情况下,用户的〜/ .m2 / settings.xml取自具有以下内容的模板文件:

<server>
    <id>${server-id}</id>
    <username>a-valid-username</username>
    <password>valid-pass</password>
</server>

稍后在settings.xml模板中,他们使用凭据复制和修改了该模板,即存储库URL。

这导致了他们可能会命中服务器并发出请求的行为,但它永远不会尝试进行身份验证。

他们收到了身份验证被拒绝的消息,并且“non_authenticated_user”显示为在request.log中发出GET请求。

一旦我们用服务器的实际ID替换了伪造的/未定义的$ {server-id},它就开始工作了。