In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
Editor to share with you how to install Maven Warehouse Manager Nexus under Linux. I hope you will get something after reading this article. Let's discuss it together.
Nexus is a powerful Maven warehouse manager that greatly simplifies the maintenance of its own internal warehouse and access to external warehouses. With Nexus you can have complete control over access to and deployment of each Artifact in the warehouse you maintain in just one place.
Install and run nexus
1. Download nexus: http://www.sonatype.org/nexus/go
You can choose tgz and zip formats, as well as war. When choosing tgz or zip, different versions may have some problems at startup, which may be due to problems with the jdk version. If you cannot start, please choose 2.5 or earlier.
Note: jdk1.6 is no longer supported after nexus version 2.6
2. Install nexus
If you download war, place it in the webapp directory under tomcat, rename it to nexus, run the tomcat service, and you can access the http://localhost:8081/nexus default user name: admin; password admin123
If you download tgz or zip, extract it to the usr/local/ directory (or you can specify your own directory), under the root/Download directory:
Cp nexus-2.2-01-bundle.zip / usr/local
Unzip nexus-2.2-01-bundle.zip
Or
Cp nexus-2.2-01-bundle.tar.gz / usr/local
Tar xvzf nexus-2.2-01-bundle.tar.gz
To facilitate updating and switching versions, create links, update or switch versions, simply update the link:
Ln-s nexus-2.2-01 nexus
3. Run nexus
Run nexus without being installed as service.
If it is a newer version:
Cd / usr/local/nexus
. / bin/nexus start
If the startup is successful, nexus will listen on port 8081 and view it in the log.
Tail-f logs/wrapper.log
Earlier versions need to be launched in the platform directory (newer versions can also be started)
Cd / usr/local/nexus/
. / bin/jsw/linux-x84-64/nexus start
Enter http://localhost:8081/nexus in the browser to enter the
4. Install nexus as service
Set up as a system service as a root user
Cd / etc/init.d
Cp / usr/local/nexus/bin / nexus. / nexus
Chmod 755 / etc/init.d/nexus
Add nexus service to Red Hat, Fedora and and CentOS
$cd / etc/init.d
Add nexus services
$chkconfig-add nexus
Add runlevels 3, 4, 5
$chkconfig-levels 345 nexus on
Start nexus
$service nexus start
Verification relationship started successfully
$tail-f / usr/local/nexus/logs/wrapper.log
Edit the text of / etc/init.d/nexus
NEXUS_HOME= "/ usr/local/nexus"
PIDDIR= "${NEXUS_HOME}"
RUN_AS_USER = "nexus" user name is optional here, preferably not root
Note: if ① uses root and no other users are created, change to root (root is not recommended)
If ② uses this setting, you need to:
Nexus user exists
Useradd nexus
Change the Owner and Group of the nexus installation directory to nexus
Chown nexus nexus nexus
Start the service
Service nexus start
Configure maven to use nexus
Here is a brief introduction to Maven installation:
Download the maven installation package, such as apache-maven-3.1.0-bin.tar.gz, and extract it
Cp apache-maven-3.1.1-bin.tar.gz / usr/local/
Tar-zxvf apache-maven-3.1.1-bin.tar.gz
Ln-s apache-maven-3.1.1 maven
Edit the / etc/profile file and add the following code
Export MAVEN_HOME=/opt/apache-maven-3.2.1
Export PATH=MAVEN_HOME/bin:$PATH
You can run the following command to check the maven installation:
Show path
Echo $MAVEN_HOME
Display information is successful
Mvn-v
To use Nexus next, you need to configure Maven to check the Nexus instead of the public repository.
Create ~ / .m2 / settings.xml (the file does not exist in the initial state), and edit the content:
Nexus
Central-snapshots
Http://localhost:8081/nexus/content/groups/public-snapshots
False
True
Central-releases
Http://localhost:8081/nexus/content/groups/public
True
False
Central-snapshots
Http://localhost:8081/nexus/content/groups/public-snapshots
False
True
Central-releases
Http://localhost:8081/nexus/content/groups/public
True
False
Nexus-releases
Admin
Admin123
Nexus-snapshots
Admin
Admin123
Nexus
Note: after configuring nexus as a mirror of all repositories, maven will consult from the local nexus installation instead of going outside to check the central maven repository. If there is a component request for nexus, the local nexus installation will provide the component; if the Nexus does not have this component, nexus will get the component from the remote repository and add it to the local image of the remote repository.
3. Configure nexus warehouse
Nexus has many default repositories: Central,Releases,Snapshots, and 3rd Party
1. Configure central Warehouse
Nexus has built-in Maven central agent warehouse Central. Select the Central in the warehouse list, as shown in figure 3.1:
Figure 3.1
Click Configuration to configure:
If Repository Policy is release, snapshot artifacts from remote repositories are not proxied (snapshot version artifacts are unstable and uncontrolled, and using such artifacts is potentially risky).
"Remote Storage Location" is the remote warehouse address, http://repo.maven.org/maven2/
Whether "Download Remote Indexes" downloads remote index files, the default is False (the central warehouse has a large number of artifacts, and its index files are also very large, so it is easy to consume a lot of central warehouse bandwidth). Set it to True (other proxy repositories also need to be changed to True), and then click Save. After the central warehouse index file downloaded by Nexus, we can search for all the artifacts of the central warehouse locally.
2.Releases is used to deploy its own release artifacts, and Snapshots is used for its own snapshot artifacts. 3rd Party is used to deploy third-party components. If you change Deployment Policy under Configuration to Allow Redeploy, you can upload local files in Artifact Upload.
New Agent Warehouse
1. New agent warehouse. Figure 3.2
Figure 3.2 New Agent Repository for nexus
two。 Add specific information. As shown in figure 3.3
3.3 add warehouse information
3. Add warehouse to group
Add warehouses to the public nexus warehouse group. Figure 3.4
Ordered Group Repositories: a warehouse already in use. The retrieval order is the same as the sort.
Available Repositories: some have not been used
Figure 3.4
IV. User use
1. Replace the file settings.xml in the / rhome/ username / .m2 directory in the development environment (this file may not be available in the new environment)
two。 Modify the / conf/settings.xml file under the maven installation directory. Modify it into a clean file.
/ workspace/repository this tag can be used to modify the local warehouse path, or it can be set in User Settings in eclipse.
3. Execute mvn clean install under [Project name], that is, download the jar package in the pom file from the private server.
4. Clean [Project name] in the eclipse development tool, and refresh the jar package directory.
After reading this article, I believe you have a certain understanding of "how to install Maven Warehouse Manager Nexus under Linux". If you want to know more about it, you are welcome to follow the industry information channel. Thank you for reading!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.