Basic configuration of MAVEN private warehouse

Source: Internet
Author: User

Maven Repository, private warehouse settings (configure remote repositories in settings.xml)

1: Index update: Replace the downloaded Nexus-maven-repository-index.zip package with D:\Nexus\sonatype-work\nexus\indexer\central-ctx
If the factory is changed, then the index page needs to be replaced

2: Configure the image to overwrite the default address of the Central warehouse
<mirrors>
<mirror>
<id>central</id>
<mirrorOf>nexus</mirrorOf><!--If you want to mirror all the warehouses then you can change to:<mirrorof>*</mirrorof>-->
<name>human readable name for this mirror.</name>
<url>http://127.0.0.1:8081/nexus/content/groups/public/</url>
</mirror>
</mirros>

The configuration in the Pom.xml file is (without modifying the default configuration):
<repository>
<id>nexus</id>
<name>nexus repository</name>
<url>http://127.0.0.1:8081/nexus/content/groups/public/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
This means that all dependencies in our project will not be found in the URLs in the Pom.xml file, but instead will be found in the URL configured in our image.
Between the two is one by one corresponding to the correlation by ID.

3: If we delete the warehouse settings in our project Pom, then we have a default warehouse setting, but we do not support the release of the snapshot version.
If we modify this default configuration, we have to use profile. The following configuration:
In the settings.xml file of our local warehouse:
<profiles>
<profile>
<id>central-repos</id>
<repositories>
<repository>
<id>central</id>
<name>Central</name>
<url>http://central</url><!--This address is invalid because we've configured all the warehouses with mirrors--
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
</profile>

<activeProfiles>
<activeProfile>central-repos</activeProfile>
</activeProfiles>

4: With the above configuration we will be able to search for our project on the Nexus instead of looking for other online maven repositories

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.