In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly introduces the relevant knowledge of "how to build Maven central warehouse on Centos". Xiaobian shows you the operation process through actual cases. The operation method is simple, fast and practical. I hope this article "how to build Maven central warehouse on Centos" can help you solve the problem.
environment
install Java
Use yum here to install java jdk, you can use the command yum search java| grep jdk to see which jdk versions are available under yum. Select version 1.8 here, install command: sudo yum install java-1.8.0-openjd
After installation, you also need to modify the environment variables. Here, we will add a java.sh file to/etc/profile.d, and the instructions are as follows:
cd /etc/profile.dsudo vim java.sh
Fill in the following:
#set java environmentjava_home=/usr/lib/jvm/java-1.8.0-openjdk-1.7.0.75.x86_64jre_home=$java_home/jreclass_path=.:$ java_home/lib/dt.jar:$java_home/lib/tools.jar:$jre_home/libpath=$path:$java_home/bin:$jre_home/binexport java_home jre_home class_path path
Then save and exit. (You need to understand the operation of vim here, this article will not be detailed)
Finally, start the environment variable with source /etc/profile, you can use java -version to see if the configuration is successful.
Install Nexus
Use wget to get the nexus installation package, here I installed version 2.11.2, the instructions are as follows:
The copy code is as follows:
wget https://sonatype-download.global.ssl.fastly.net/nexus/oss/nexus-2.11.2-03-bundle.tar.gz
Then unzip it in the current directory and go to the folder:
tar -zxvf nexus-2.11.2-03-bundle.tar.gzmv nexus-2.11.2-03 nexus #rename folder cd nexus
After unpacking, you can see that there are two folders, one for nexus services and one for its private repository directory.
Then edit the nexus script, which is located in nexus_home/bin, with the following instructions:
vi bin/nexus
Change run_as_user to run_as_user=root
Here you also need to adjust your firewall configuration, open the appropriate port, here will not go into detail.
Then start the nexus service using the following command:
./ bin/nexus start
You can now access the Nexus service in your browser!
You can log into the system from the log in in the upper right corner. There are three default roles. We first use the admin role to enter the system. The default password for admin is admin123.
Click users on the left to view the current system users. There are three users: admin, deployment and anonymous.
admin: This user has full permissions on Nexus, and the default password is admin123.
Deployment: This user can access nexus, browse repository content, search, upload deployment artifacts, but cannot configure nexus. The default password is deployment123.
anonymous: This user corresponds to all anonymous users who are not logged in and can browse the repository and search.
Click on repositories again and we can see that there are several default types, we will use third-party type repository here, so we need to enable its support for compilation upload
There are many other things that can be done through ui, which we won't go into here. Here's how to upload packaged jars locally to nexus via maven.
maven packaging and deployment
First we need to modify the local maven configuration to add the remote repository username and password. First find the settings.xml file for your local maven. You can use mvn -version to find the address of maven:
You can see the maven home address here, and then go to settings.xml under config in this folder and add server to it. Here we'll use the third party for that warehouse.
Then add the following to the maven dependency of the project you want to package:
org.apache.maven.plugins maven-compiler-plugin 1.8 1.8 org.apache.maven.plugins maven-jar-plugin 2.4 true lib/ maven-deploy-plugin deploy deploy deploy 3rd party repository_url
The repository_url here refers to the location of your repository, which can be viewed on the repository page shown earlier.
maven packaged instructions
mvn clean package
It will be here./ See the packaged jar file in the target directory, and then deploy it with the following command:
mvn deploy:deploy-file -dgroupid=com.xy.oracle -dartifactid=ojdbc14 -dversion=10.2.0.4.0 -dpackaging=jar -dfile=./ target/xxx.jar -durl=http://ip:8081/nexus/content/repositories/thirdparty/ -drepositoryid=thirdparty
After that, you can see the jar package deployed on the web side.
The content of "How to build Maven central repository on Centos" is introduced here. Thank you for reading it. If you want to know more about industry-related knowledge, you can pay attention to the industry information channel. Xiaobian will update different knowledge points for you every day.
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.