将本地存储库添加到 maven settings.xml [英] Add local repository to maven settings.xml

查看:92
本文介绍了将本地存储库添加到 maven settings.xml的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的机器上有一个本地存储库.我需要将它添加到 maven 的 settings.xml 中.我在网上找到的所有例子都是这样的:

I have a local repository on my machine. I need to add it to maven's settings.xml. All the examples I've found online look like this:

<settings>
  <profiles>
    <profile>
      <id>myprofile</id>
      <repositories>
        <repository>
          <id>androidsupport</id>
          <name>Android Support</name>
          <url>http://www.whatever.com/maven2/</url>
        </repository>
     </repositories>
    </profile>

      <activeProfiles>
        <activeProfile>myprofile</activeProfile>
      </activeProfiles>
  </profiles>
</settings>

我需要将其指向本地存储库.我该怎么做?

I need to point it to a local repo. How can I do that?

推荐答案

我认为您可以通过在 settings.xml 中添加以下内容来实现:

I think you can do it via adding into settings.xml this:

<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>C:/MyLocalRepository</localRepository>
</settings>

您可以在此处找到更多详细信息.

More details you can find there.

要添加更多内部存储库,您可以使用:

To add more internal repositories you can use:

<project>
  ...
  <repositories>
    <repository>
      <id>my-internal-site</id>
      <url>file:///C:/MyLocalRepository</url>
    </repository>
  </repositories>
  ...
</project>

您可以在此处找到更多详细信息.

More details you can find there.

这篇关于将本地存储库添加到 maven settings.xml的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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