简体   繁体   中英

Add local repository to 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?

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 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM