当前位置:网站首页>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
边栏推荐
- Idea2021.1 installation tutorial
- Connect Porsche and 3PL EDI cases
- Leetcode question brushing record | 933_ Recent requests
- dstat使用[通俗易懂]
- IP地址转换地址段
- A few lines of code to complete RPC service registration and discovery
- 剑指 Offer 26. 树的子结构
- 寒门再出贵子:江西穷县考出了省状元,做对了什么?
- 【Leetcode】14. Longest Common Prefix
- 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
猜你喜欢

Baobab's gem IPO was terminated: Tang Guangyu once planned to raise 1.8 billion to control 47% of the equity

Jiuxian's IPO was terminated: Sequoia and Dongfang Fuhai were shareholders who had planned to raise 1billion yuan

剑指 Offer 22. 链表中倒数第k个节点

Changwan group rushed to Hong Kong stocks: the annual revenue was 289million, and Liu Hui had 53.46% voting rights

宝宝巴士创业板IPO被终止:曾拟募资18亿 唐光宇控制47%股权

How openharmony starts FA of remote devices
![[leetcode] 14. Préfixe public le plus long](/img/70/e5be1a7c2e10776a040bfc8d7711a0.png)
[leetcode] 14. Préfixe public le plus long

移动应用性能工具探索之路

QStyle实现自绘界面项目实战(二)

Cell: Tsinghua Chenggong group revealed an odor of skin flora. Volatiles promote flavivirus to infect the host and attract mosquitoes
随机推荐
Weili holdings listed on the Hong Kong Stock Exchange: with a market value of HK $500million, it contributed an IPO to Hubei
executescalar mysql_ ExecuteScalar()
体验居家办公完成项目有感 | 社区征文
JS delete substring in string
七张图,学会做有价值的经营分析
A few lines of code to complete RPC service registration and discovery
Eye of depth (III) -- determinant of matrix
P6774 [noi2020] tears in the era (block)
Connect Porsche and 3PL EDI cases
Domestic relatively good OJ platform [easy to understand]
寒门再出贵子:江西穷县考出了省状元,做对了什么?
13、Darknet YOLO3
LSF basic command
Soul, a social meta universe platform, rushed to Hong Kong stocks: Tencent is a shareholder with an annual revenue of 1.28 billion
What if the default browser cannot be set?
class和getClass()的区别
Sword finger offer 27 Image of binary tree
[error record] error -32000 received from application: there are no running service protocol
2、 Expansion of mock platform
&lt; IV & gt; H264 decode output YUV file