Build Maven private server and maven

Source: Internet
Author: User
Tags sonatype

Build Maven private server and maven

Recently, the company's personnel revolution has resulted in the departure of a group of employees. I feel a sudden increase in pressure. I am working on android and want to work on the background interface. It's a little hard. It's already 30 minutes, there are still various kinds of hard work, but as a technical control, such happiness cannot be understood by others. In the past few days, I checked Out the background code, but I couldn't help running it. It really hurts to build Maven in the Mac system, so I hate the background team's friends for not building Maven private servers. Okay, let me do it, the words in this company are full. If you have successfully built a server, you can easily find a server and try again.
1. Go to http://www.sonatype.com/download-oss-sonatypeto download nexus-bundle
: Http://www.sonatype.org/downloads/nexus-latest-bundle.zip
2. decompress and download the nexus-2.13.0-01-bundle.
  
3. Install and run the nexus service.
Change the nexus service port (optional)
  
The default port 8081 is used here.
  
5. Modify the Maven configuration file % userprofile % \. m2 \ setting. xml.
  
Content of setting. xml (You should replace 'username', 'Password' & 'url' in the file if you have changed them .)

<servers>    <server>        <id>releases</id>        <username>admin</username>        <password>adminsa</password>    </server>    <server>        <id>snapshots</id>        <username>admin</username>        <password>adminsa</password>    </server></servers><mirrors>    <mirror>        <id>nexus</id>        <mirrorOf>*</mirrorOf>        <url>http://127.0.0.1:8081/nexus/content/groups/public/</url>    </mirror></mirrors><profiles>    <profile>    <id>nexus</id>    <repositories>        <repository>            <id>central</id>            <url>http://central</url>            <releases><enabled>true</enabled></releases>            <snapshots><enabled>true</enabled></snapshots>        </repository>    </repositories>    <pluginRepositories>        <pluginRepository>            <id>central</id>            <url>http://central</url>            <releases><enabled>true</enabled></releases>            <snapshots><enabled>true</enabled></snapshots>        </pluginRepository>    </pluginRepositories>    </profile></profiles><activeProfiles>    <activeProfile>nexus</activeProfile></activeProfiles>

6. Client configuration (assuming Maven runtime environment has been configured)
Add Maven private server configuration for pom. xml
  
Content of add item

<repositories>    <repository>    <id>nexus</id>    <name>Team Nexus Repository</name>    <url>http://127.0.0.1:8081/nexus/content/groups/public</url>    </repository></repositories><pluginRepositories>    <pluginRepository>    <id>nexus</id>    <name>Team Nexus Repository</name>    <url>http://127.0.0.1:8081/nexus/content/groups/public</url>    </pluginRepository></pluginRepositories>

7. Client test (Maven Project is required and A Simple Maven Project is not downloaded)
Go to the Maven project directory (the directory where pom. xml is located)
  
8. Verify Maven private server (Repositories-> Repository Path [Central])
  
9. See that the plexus-utils-3.0 just downloaded using the mvn clean command has been in the private server repository, then if other machines in the LAN test will be directly downloaded from the private server, saving resources for the project build.
You can see that the results of one morning have been downloaded on another machine (the Mac system is sometimes speechless)
  
Let's take a look at the modified pom. xml and then see what the build looks like.
  
After the build is complete, is it easy to use? It is worth mentioning that other clients also need to create the setting. xml configuration Maven private server in the. m2 subdirectory of the user directory. Directly update indecies on Intellij Idea. The downloaded Maven has been configured. The reason is being investigated.
  

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.