当前位置:网站首页>Introduction to nexus and detailed tutorial of Xiaobai using idea to package and upload to nexus3 private server
Introduction to nexus and detailed tutorial of Xiaobai using idea to package and upload to nexus3 private server
2022-07-02 17:20:00 【Full stack programmer webmaster】
Hello everyone , I meet you again , I'm your friend, Quan Jun .
Use IDEA Package and upload to Nexus3 Private clothes
One 、Nexus What is it?
Start using Maven when , Always hear nexus The word , For a while maven, For a while nexus, Why is it always with maven Mentioned together ?
Maven As a Excellent build tools 、 Dependency management tool 、 Project information management tools , During dependency management , adopt pom.xml Inside
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
<version>2.1.0</version>
</dependency>To accurately locate and find the corresponding Java Class library . In this process, we need to start from Warehouse To find the corresponding jar The package was introduced into our project , Thus, we solved the problem of Increased dependence 、 Version inconsistency 、 Version conflict 、 Rely on bloated Other questions .
Maven Yes Local repository and Remote warehouse Two kinds of , When Maven When looking for components according to coordinates , It first looks at the local warehouse , If this component exists in the local warehouse , Direct use ; If this component does not exist in the local warehouse , Or you need to see if there is an updated component version ,Maven Will go to the remote warehouse to find , After finding the required artifacts , Download it to the local warehouse and use it again .
When it comes to this , I believe you also understand ,Nexus It's a remote warehouse , It is also a kind of private service .
SNAPSHOT Snapshot version , stay maven in SNAPSHOT Version represents official release (release) Previous development version , stay pom of use x.y-SNAPSHOT Express .
RELEASE The release , Stable version , stay maven in RELEASE Represents a stable version ,unchange, Unalterable , stay maven in SNAPSHOT And RELEASE Version is a completely different way of strategy ,SNAPSHOT It will vary according to your configuration , Frequent updates from remote warehouse to local warehouse ; and RELEASE It will only be downloaded to the local warehouse for the first time , In the future, we will look directly from the local warehouse .
Two 、 Use Nexus3 build maven Private clothes
Find some references on the Internet : Windows Use in Nexus3 build maven Private clothes maven Private clothes nexus3.x build And use Maven Private clothes Nexus3.x Environment build operation record
3、 ... and 、IDEA Package and upload to Nexus3 Private clothes
1. To configure .m2 Under the settings.xml
First , This file is on the system disk of the current device login user .m2 Under the document , Join the authentication mechanism
No, go online copy A configured one , Self configuration is easy to make mistakes
->settings.xml<-
<servers>
<server>
<id>nexus</id>
<username>admin</username>
<password>admin123</password>
</server>
<server>
<id>maven-snapshots</id>
<username>admin</username>
<password>admin123</password>
</server>
<server>
<id>maven-releases</id>
<username>admin</username>
<password>admin123</password>
</server>
<server>
<id>rdc-releases</id>
<username>xxxxxxxxx</username>
<password>xxxxx</password>
</server>
<server>
<id>rdc-snapshots</id>
<username>xxxxxxxxx</username>
<password>xxxx</password>
</server>
</servers>1. To configure IDEA project Under the pom.xml
<distributionManagement>
<repository>
<id>nexus</id>
<name>nexus</name>
<url>http://xxxx:port/repository/maven-snapshots/</url>
</repository>
<snapshotRepository>
<id>maven-snapshots</id>
<name>maven-snapshots</name>
<url>http://xxxx:port/repository/maven-snapshots/</url>
</snapshotRepository>
</distributionManagement>Here's the... In the tag id Corresponding to Article 1 server Medium id ,url The obtained value can be written directly here , It can also be shown in the figure below settings Value in file ,name You can customize ->settings.xml<-
<profile>
<altReleaseDeploymentRepository> http://xxxx:port/repository/maven-snapshots/ </altReleaseDeploymentRepository>
<altSnapshotDeploymentRepository> http://xxxx:port/repository/maven-snapshots/</altSnapshotDeploymentRepository>
</profile>Again , above pom.xml Change to the following format
<distributionManagement>
<repository>
<id>nexus</id>
<name>nexus</name>
<url>${altReleaseDeploymentRepository}</url>
</repository>
<snapshotRepository>
<id>maven-snapshots</id>
<name>maven-snapshots</name>
<url>${altSnapshotDeploymentRepository}</url>
</snapshotRepository>
</distributionManagement>3. Configure the upload address , Address to private server copy
<profile>
<!--profile Of id-->
<id>dev</id>
<repositories>
<repository>
<!-- Warehouse id,repositories Multiple warehouses can be configured , Guarantee id No repetition -->
<id>nexus</id>
<!-- Warehouse address , namely nexus Address of the warehouse group -->
<url>http://localhost:8081/nexus/content/groups/public/</url>
<!-- Download or not releases artifacts -->
<releases>
<enabled>true</enabled>
</releases>
<!-- Download or not snapshots artifacts -->
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<!-- Plug-in repository ,maven It depends on plug-ins , Also need to download plug-ins from private server -->
<pluginRepository>
<!-- Plug in repository id No repetition , If you repeat the back configuration, the front edge will be overwritten -->
<id>central</id>
<name>Nexus Plugin Repository</name>
<url>http://central</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
</profile>4. Other configuration ( Negligible )
For example, configure Ali's image , Map Ali central warehouse ( download jar Hurry up )
<mirrors>
<mirror>
<id>alimaven</id>
<name>aliyun maven</name>
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
<mirrorOf>central</mirrorOf>
</mirror>
</mirrors>Configure local warehouse ( No need for networking jar package )
<localRepository>E:\maven_repository</localRepository>5.settings.xml Full configuration ( Source network , For reference only )
<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
<!-- Local warehouse address -->
<localRepository>D:\mvn_repo\repository</localRepository>
<!-- The following configuration is upload jar Package configuration -->
<pluginGroups>
</pluginGroups>
<proxies>
</proxies>
<servers>
<server>
<!-- id, In the corresponding project pom.xml Inside distributionManagement Configured id -->
<id>maven-releases</id>
<!-- Sign in nexus Username -->
<username>admin</username>
<!-- Sign in nexus Password -->
<password>admin123</password>
</server>
<server>
<!-- id, In the corresponding project pom.xml Inside distributionManagement Configured id -->
<id>maven-snapshots</id>
<!-- Sign in nexus Username -->
<username>admin</username>
<!-- Sign in nexus Password -->
<password>admin123</password>
</server>
<!-- Configure interceptors mirror Login user name and password . He will intercept all requests to mirror Download from the specified address jar package If you only need to go to the private server to download jar Package, you only need to configure this item -->
<server>
<!-- id, Corresponding mirror in id -->
<id>nexus</id>
<username>admin</username>
<password>admin123</password>
</server>
</servers>
<!-- The following configuration is for download jar Package configuration Universal -->
<mirrors>
<!-- To coerce jar Package download private server -->
<mirror>
<id>nexus</id>
<mirrorOf>*</mirrorOf>
<url>http://192.168.65.129:8081/repository/maven-public/</url>
</mirror>
</mirrors>
<profiles>
<profile>
<!-- Corresponding activeProfiles-activeProfile The content of -->
<id>nexus</id>
<!-- Warehouse address -->
<repositories>
<repository>
<!-- Private clothes id, Cover maven-model The parent under the module id, Give Way maven Don't go to the central warehouse to download , Go to private server to download -->
<id>central</id>
<!-- name -->
<name>Nexus</name>
<!-- Private address , Write central after , Will go to mirror Inside looking for -->
<url>http://central</url>
<!-- Support releases edition -->
<releases>
<enabled>true</enabled>
</releases>
<!-- Support snapshots edition -->
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
<!-- Plug-in address -->
<pluginRepositories>
<pluginRepository>
<id>central</id>
<name>Nexus Plugin Repository</name>
<url>http://central</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
<!-- Configure Global url Address For uploading jar Dynamic acquisition when package -->
<properties>
<ReleaseRepository>http://192.168.65.129:8081/repository/maven-releases/</ReleaseRepository>
<SnapshotRepository>http://192.168.65.129:8081/repository/maven-snapshots/</SnapshotRepository>
</properties>
</profile>
</profiles>
<!-- Choose to use profile -->
<activeProfiles>
<activeProfile>nexus</activeProfile>
<!-- <activeProfile>rdc</activeProfile>-->
</activeProfiles>
</settings>6.IDEA Package and upload
Use idea pack , Packaging will be based on pom In file version Determine whether it is a snapshot version or a release version ,version in 0.0.1-SNAPSHOT belt SNAPSHOT Is the snapshot version , Delete SNAPSHOT Release version for , Upload to private server according to version Automatically determine which warehouse to upload to
Be careful , When the packaging Project pom Make sure that the document is filled with maven-plugin Delete the , Otherwise, after the package is completed, it will generate BOOT-INF Folder , It will cause after uploading to the private server , After the dependency is configured, it can be downloaded to jar package , But no error can be found using the times package
<version>1.1-SNAPSHOT</version>
<build>
</build>then clean after deploy
notice BUILD SUCCESS The prompt is success , You can check on your private server
Publisher : Full stack programmer stack length , Reprint please indicate the source :https://javaforall.cn/148092.html Link to the original text :https://javaforall.cn
边栏推荐
- Sword finger offer 24 Reverse linked list
- Baobab's gem IPO was terminated: Tang Guangyu once planned to raise 1.8 billion to control 47% of the equity
- What if the default browser cannot be set?
- 宝宝巴士创业板IPO被终止:曾拟募资18亿 唐光宇控制47%股权
- 亚马逊云科技 Community Builder 申请窗口开启
- 剑指 Offer 26. 树的子结构
- P6774 [noi2020] tears in the era (block)
- Un an à dix ans
- 【征文活动】亲爱的开发者,RT-Thread社区喊你投稿啦
- executescalar mysql_ExecuteScalar()
猜你喜欢

Soul, a social meta universe platform, rushed to Hong Kong stocks: Tencent is a shareholder with an annual revenue of 1.28 billion

关于我

Sword finger offer 25 Merge two sorted linked lists

GeoServer:发布PostGIS数据源

The macrogenome microbiome knowledge you want is all here (2022.7)

线性规划例题 投资的收益与风险

寒门再出贵子:江西穷县考出了省状元,做对了什么?

What if the default browser cannot be set?

电脑自带软件使图片底色变为透明(抠图白底)

Use of openpose
随机推荐
IP地址转换地址段
Fuyuan medicine is listed on the Shanghai Stock Exchange: the market value is 10.5 billion, and Hu Baifan is worth more than 4billion
深度之眼(二)——矩阵及其基本运算
MOSFET器件手册关键参数解读
人生的开始
Linux Installation PostgreSQL + Patroni cluster problem
Ap和F107数据来源及处理
The poor family once again gave birth to a noble son: Jiangxi poor county got the provincial number one, what did you do right?
一年頂十年
IDEA2021.1 安装教程
【Leetcode】14. 最長公共前綴
Briefly introduce the use of base64encoder
2022 interview questions
13、Darknet YOLO3
Nexus簡介及小白使用IDEA打包上傳到Nexus3私服詳細教程
Does digicert SSL certificate support Chinese domain name application?
dstat使用[通俗易懂]
Learning Weekly - total issue 60 - 25th week of 2022
深度之眼(三)——矩阵的行列式
class和getClass()的区别