当前位置:网站首页>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
边栏推荐
- Notice on holding a salon for young editors of scientific and Technological Journals -- the abilities and promotion strategies that young editors should have in the new era
- One year is worth ten years
- 13、Darknet YOLO3
- A few lines of code to complete RPC service registration and discovery
- Weili holdings listed on the Hong Kong Stock Exchange: with a market value of HK $500million, it contributed an IPO to Hubei
- 畅玩集团冲刺港股:年营收2.89亿 刘辉有53.46%投票权
- 相信自己,这次一把搞定JVM面试
- Green bamboo biological sprint Hong Kong stocks: loss of more than 500million during the year, tiger medicine and Beijing Yizhuang are shareholders
- traceroute命令讲解
- 默认浏览器设置不了怎么办?
猜你喜欢
The poor family once again gave birth to a noble son: Jiangxi poor county got the provincial number one, what did you do right?
[essay solicitation activity] Dear developer, RT thread community calls you to contribute
Soul, a social meta universe platform, rushed to Hong Kong stocks: Tencent is a shareholder with an annual revenue of 1.28 billion
例题 非线性整数规划
博客主题 “Text“ 夏日清新特别版
【征文活动】亲爱的开发者,RT-Thread社区喊你投稿啦
Believe in yourself and finish the JVM interview this time
Baobab's gem IPO was terminated: Tang Guangyu once planned to raise 1.8 billion to control 47% of the equity
体验居家办公完成项目有感 | 社区征文
剑指 Offer 21. 调整数组顺序使奇数位于偶数前面
随机推荐
一年顶十年
MOSFET器件手册关键参数解读
Geoserver: publishing PostGIS data sources
Jiuxian's IPO was terminated: Sequoia and Dongfang Fuhai were shareholders who had planned to raise 1billion yuan
Nexus简介及小白使用IDEA打包上传到Nexus3私服详细教程
OpenPose的使用
伟立控股港交所上市:市值5亿港元 为湖北贡献一个IPO
What is generics- Introduction to generics
How to quickly distinguish controlled components from uncontrolled components?
Sword finger offer 22 The penultimate node in the linked list
Qwebengineview crash and alternatives
Dstat use [easy to understand]
一文看懂:数据指标体系的4大类型
The impact of telecommuting on all aspects of our experience | community essay solicitation
LSF basic command
Experience home office, feel the completion of the project | community essay solicitation
The poor family once again gave birth to a noble son: Jiangxi poor county got the provincial number one, what did you do right?
What is agile development process
剑指 Offer 27. 二叉树的镜像
VMware install win10 image