如何在Maven 2中使用Maven 1存储库? [英] How to use a maven 1 repository with maven 2?

查看:56
本文介绍了如何在Maven 2中使用Maven 1存储库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在构建项目(使用Maven 2)时遇到问题,该项目引用了Maven 1存储库中的一些jar.

I am having problem building my project (using maven 2) which references some jars from a maven 1 repository.

方案:我的公司有一个私有的maven 1存储库,其中包含以下信息:

The scenario: My company has a private maven 1 repository that has the following info:

<url>http://my-company-maven1-repo/maven-repository<url>

它的布局是:

   maven-repository
              |_repository
                     |_ ....
                     |_ ....
                     |_vectorgraphics
                              |_jars
                                  |_freehep_swing-2.0.3.jar
                                  |_freehep_io-2.0.2.jar

我尝试过的方法: 1.请按照此处的指南进行操作:相关的maven官方文档 我的mvn2 pom.xml:

What I have tried: 1. Following the guide here: relevant maven official docs My mvn2 pom.xml:

<repository>
  <snapshots>
    <enabled>true</enabled>
  </snapshots>
  <id>my-repo</id>        <-- I made up a temporary id/name
  <name>my_repo></name>
  <url>http://my-company-maven1-repo/maven-repository<url>
  <layout>
<repository>
<dependencies>
  <dependency>
    <groupId>vectorgraphics</groupId>
    <artifactId>freehep-swing</artifactId>
    <version>2.0.3</version>
    <scope>jar</scope>
  </dependency>
</dependencies>

结果很奇怪,我公司的maven1回购被完全忽略.相反,mvn2尝试从"maven2 central"下载jar:

The result was weird, my company's maven1 repo was completely ignored. Instead, mvn2 attempted to download the jar from "maven2 central":

Downloading http://repo1.maven.org/maven2/vectorgraphics/freehep-swing/2.0.3/freehep-swing-2.0.3.pom 

所生成的freehep-swing-2.0.3.pom(在我的本地.m2/repository/中)具有以下错误:

And the resulted freehep-swing-2.0.3.pom (in my local .m2/repository/) has the following errors:

legacy-http\://my-company-maven1-repo/maven-repository/.lastUpdated=1305430120039
http\://my-company-maven1-repo/maven-repository/.error=Could not transfer artifact vectorgraphics\:freehep-swing\:pom\:2.0.3 from/to my-repo (http\://my-company-maven1-repo/maven-repository)\: No connector available to access repository my-repo (http\://my-company-maven1-repo/maven-repository) of type legacy using the available factories AsyncRepositoryConnectorFactory, WagonRepositoryConnectorFactory
http\://repo1.maven.org/maven2/.error=
http\://repo1.maven.org/maven2/.lastUpdated=1305430120281

如果有人可以告诉我如何从maven1存储库中获取freehep_swing-2.0.3.jar(布局如上所示),我将非常感谢.

If anyone can point out to me how to fetch that freehep_swing-2.0.3.jar from the maven1 repository (with layout shown above), I would really really appreciate that.

谢谢

推荐答案

Nexus存储库管理器能够Maven {2,3}客户端的代理Maven 1存储库.

The Nexus repository manager is able to proxy Maven 1 repositories for Maven {2,3} clients.

Maven 3不再具有使用旧版"存储库的可能性,请参见

Maven 3 no longer has the possibility of using 'legacy' repositories, see Maven 3.x compatibility notes.

这篇关于如何在Maven 2中使用Maven 1存储库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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