Setting up a MAVEN nexus under Ubuntu server
The purpose of the MAVEN Nexus is primarily to conserve resources and to use it internally as a MAVEN development resource-sharing server.
1. Download
Enter Ubuntu server via ROOT user
$ cd/opt
$ wget http://download.sonatype.com/nexus/oss/nexus-2.10.0-02-bundle.tar.gz
2. Start
$ cd/opt/
$ TAR-ZXVF nexus-2.10.0-02-bundle.tar.gz
$ cd/opt/nexus-2.10.0-02/bin
$ VI Nexus
In the boot file nexus to increase the nexus of the start user, or no permission to start, will be the following error:
Warning-not RECOMMENDED to RUN as ROOT
If you insist running as root and then set the environment variable run_as_user=root before running this script
So to solve this problem, you need to start the file Nexus, plus run_as_user=root,
After saving the exit, you can start the Nexus with the following command:
$./nexus Start
Starting Nexus OSS ...
Started Nexus OSS.
Indicates the boot success, access address: Http://ip:8081/nexus
3. Configure Nexus
Login nexus, upper right corner log in, default login username password: admin/admin123
After logging in, we can click on the left menu bar repositories to enter the detailed configuration
You can re-create a configuration, here we use the system in the public repositories
About the types of warehouses
Hosted type of warehouse, internal project release warehouse
Release repository for the release module in the releases internal module
Snapshots Release the warehouse of the internal snapshot module
3rd The third party relies on the warehouse, this data is usually downloaded by the internal personnel after the release
Proxy type of warehouse, from the remote central warehouse to find the Data Warehouse
A warehouse of group type that is used by the warehouse to facilitate the setup of our developers.
However, it is necessary to map the library configuration of several other agents into public, select "True" for the Apache snapshots, Central, Codehaus sanpshots download Remote indexes option, and save the The default is false, such as
Configure the Library Apache snapshots, Central, and Codehaus sanpshots of type Proxy to public repositories, such as:
Then the Apache snapshots, Central, Codehaus sanpshots updated index, right-click on each of the Libraries repair index
Finally, the public repositories operation repair Index
Then you can test the MAVEN repository.
4. Remote Test maven Warehouse
In the project, refer to the MAVEN repository. You need to add the following to the project's Pom.xml file:
<repositories> <Repository> <Snapshots> <enabled>True</enabled> </Snapshots> <ID>Public</ID> <name>Public repositories</name> <URL>http://192.168.10.50:8081/nexus/content/groups/public/</URL> </Repository></repositories>
Then execute the MAVEN download dependent jar to detect if the download was successful-on the Artifact Search window on the left, and see if the jar package was successfully downloaded.
In addition, we usually modify the configuration file Setting.xml in the local MAVEN installation directory, replace the local repository with a non-warehouse address, and ensure that all the items on this client will be used, with the configuration Setting.xml as follows:
Join in <profiles></profiles>
<profiles>
<repositories> <Repository> <Snapshots> <enabled>True</enabled> </Snapshots> <releases> <enabled>True</enabled> </releases> <ID>Public</ID> <name>Public repositories</name> <URL>http://192.168.10.50:8081/nexus/content/groups/public/</URL> </Repository> </repositories>
</profiles><Activeprofiles> <Activeprofile>Public</Activeprofile> </Activeprofiles>
and join in <mirrors></mirrors>
<Mirror> <ID>Mirrorid</ID> <mirrorof>Repositoryid</mirrorof> <name>Human readable Name for this Mirror.</name>
<URL>Http://192.168.10.50:8081/nexus/content/groups/public</URL></Mirror>
Create a new project, build and test
5. Three-party jar package into maven
For example, some third-party jar packages, not in the MAVEN central warehouse, this time need to manually upload the jar locally for other local users to use, a brief introduction
Setting up a MAVEN nexus under Ubuntu server