你知道mvnrepository.com的maven个人资料吗?

use*_*045 59 profile dependencies maven-2 dependency-management maven

我试图在我的maven项目中包含一些依赖项.这些依赖项在默认的Mven 2存储库http://repo1.maven.org/maven2/中不可用.

它们可在http://mvnrepository.com/上找到

但是我找不到此站点的配置文件以包含在我的settings.xml中

有谁知道这个存储库的网址和个人资料是什么?

谢谢.

Tri*_*tan 70

一旦你通过mvnrepository.com找到了你的jar,将鼠标悬停在"下载(JAR)"链接上,你会看到包含你的jar的存储库的链接(你可能可以使用右键和"复制链接URL"来获取URL,你的浏览器是什么).

然后,您必须在pom.xml中将此存储库添加到项目使用的存储库中:

<project>
  ...
  <repositories>
    <repository>
      <id>my-alternate-repository</id>
      <url>http://myrepo.net/repo</url>
    </repository>
  </repositories>
  ...
</project>
Run Code Online (Sandbox Code Playgroud)

编辑:现在MVNrepository.com已经发展:你可以在"存储库"部分找到存储库的链接:

执照

分类

主页

日期

  • 这是一个很好的答案,您可能还希望包括Nicolas下方显示的“快照”和“发行”选项。 (2认同)

bma*_*ies 43

mvnrepository.com不是存储库.这是一个搜索引擎.如果它不是中心的话,它可能会或可能不会告诉你它找到了哪些存储库; 因为你没有发布一个例子,我无法帮助你阅读输出.


Nic*_*las 17

您可以将此配置放在settings.xml文件中:

            <repository>
                <id>mvnrepository</id>
                <url>http://repo1.maven.org/maven2</url>
                <snapshots>
                    <enabled>false</enabled>
                </snapshots>
                <releases>
                    <enabled>true</enabled>
                </releases>
            </repository>
Run Code Online (Sandbox Code Playgroud)

  • 这是核心,而不是mvn. (2认同)

小智 6

请使用此个人资料

  <profiles>
    <profile>
        <repositories>
            <repository>
                <id>mvnrepository</id>
                <name>mvnrepository</name>
                <url>http://www.mvnrepository.com</url>
            </repository>
        </repositories>
    </profile>
  </profiles>
  <activeProfiles>
    <activeProfile>mvnrepository</activeProfile>
  </activeProfiles>
Run Code Online (Sandbox Code Playgroud)

  • 我不会自称是Maven专家,但是为什么其他答案会说mvnrepository不是有效的存储库?(即使它是其他存储库的“代理”) (3认同)
  • 对我不起作用。它需要配置文件上的 id,然后我需要在 activeProfiles 而不是存储库中链接配置文件? (3认同)